//获取鼠标X、Y轴坐标 function mousePosition(ev){ if(ev.pageX || ev.pageY){ return {x:ev.pageX, y:ev.pageY}; } return { x:ev.clientX + document.body.scrollLeft - document.body.clientLeft, y:ev.clientY + document.body.scrollTop - document.body.clientTop }; } function getX(ev){ ev = ev || window.event; var mousePos = mousePosition(ev); var x = mousePos.x; return x; } function getY(ev){ ev = ev || window.event; var mousePos = mousePosition(ev); var y = mousePos.y; return y; }
详细解决方案
获取鼠标X、Y轴座标
热度:94 发布时间:2012-10-25 10:58:58.0
相关解决方案