Home >Web Front-end >JS Tutorial >Use javascript to position the mouse position in firefox_javascript skills
/**
* Get mouse coordinates
* @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