标签:span color clientx epo pre obj sep 坐标 pagex
//获取鼠标位置
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 };
}
var obj=getMousePos(event);
var Mousex=obj.x;//横坐标
var Mousey=obj.y;//纵坐标
标签:span color clientx epo pre obj sep 坐标 pagex
原文地址:http://www.cnblogs.com/web520/p/6824355.html