Home >Web Front-end >JS Tutorial >Use javascript to position the mouse position in firefox_javascript skills

Use javascript to position the mouse position in firefox_javascript skills

WBOY
WBOYOriginal
2016-05-16 19:12:171727browse

/**
* 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 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn