获取页面的滚动位置与鼠标事件中的座标
获取页面的滚动位置与鼠标事件中的坐标/**获取当前滚动的位置。*/function getScrollingPosition(){var pos
获取页面的滚动位置与鼠标事件中的坐标
/** 获取当前滚动的位置。*/function getScrollingPosition(){var position = [0, 0]; //FFif (typeof window.pageYOffset != 'undefined'){position = [window.pageXOffset,window.pageYOffset];} //IEelse if (typeof document.documentElement.scrollTop!= 'undefined' && document.documentElement.scrollTop > 0 ||document.documentElement.scrollLeft > 0){position = [document.documentElement.scrollLeft,document.documentElement.scrollTop];}else if (typeof document.body.scrollTop != 'undefined'){position = [document.body.scrollLeft,document.body.scrollTop];}return position;}
/** 获取鼠标位置*/function displayCursorPosition(event){ if (typeof event == "undefined") { event = window.event; } var scrollingPosition = getScrollingPosition(); var cursorPosition = [0, 0]; if (typeof event.pageX != "undefined" && typeof event.x != "undefined") { cursorPosition[0] = event.pageX; cursorPosition[1] = event.pageY; } else { cursorPosition[0] = event.clientX + scrollingPosition[0]; cursorPosition[1] = event.clientY + scrollingPosition[1]; } document.title = cursorPosition.toString();}