//相对于整个网页的坐标
$(document).click(function(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);
});
//相对于窗口的坐标
$(document).click(function(event){
event = event||window.event;
//获得相对于body定位的横标值;
x=event.clientX
//获得相对于body定位的纵标值;
y=event.clientY
alert(x+"==="+y);
});
$(document).click(function(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);
});
//相对于窗口的坐标
$(document).click(function(event){
event = event||window.event;
//获得相对于body定位的横标值;
x=event.clientX
//获得相对于body定位的纵标值;
y=event.clientY
alert(x+"==="+y);
});