firefox中用javascript实现鼠标位置的定位
人气:0
/**
* 取得鼠标坐标
* @return Position
*/
function getMouseLocation(){
if(ns4||ns6){
mouseX = e.pageX;
mouseY = e.pageY;
}
else{
mouseX = event.x + document.body.scrollLeft;
mouseY = event.y + document.body.scrollTop;
}
return {x:mouseX,y:mouseY};
}
在strict下document.body要改成document.documentElement
* 取得鼠标坐标
* @return Position
*/
function getMouseLocation(){
if(ns4||ns6){
mouseX = e.pageX;
mouseY = e.pageY;
}
else{
mouseX = event.x + document.body.scrollLeft;
mouseY = event.y + document.body.scrollTop;
}
return {x:mouseX,y:mouseY};
}
在strict下document.body要改成document.documentElement
加载全部内容