获取鼠标位置
时间:2017-12-07 18:28:32
收藏:0
阅读:235
//获取鼠标位置 function getMousePos(event) { var e = event || window.event; var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; var scrollY = document.documentElement.scrollTop || document.body.scrollTop; var x = e.pageX || e.clientX + scrollX; var y = e.pageY || e.clientY + scrollY; //alert(‘x: ‘ + x + ‘\ny: ‘ + y); return { ‘x‘: x, ‘y‘: y }; }
原文:http://www.cnblogs.com/web520/p/8000260.html
评论(0)