<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Document</title>
</head>
<body>
</body>
</html>
<script>
document.onclick=function (event) //event是事件对象
{
console.log(event.clientX); //返回事件对象(document)的x坐标 ,这种写法ie678不兼容
console.log(event.clientY); //返回事件对象(document整个文档)的y 坐标
console.log(window.event.clientX);//ie678的写法
var event=event || window.event; //兼容式写法
console.log(event.clientX);
console.log(event.clientY);
console.log(pageXOffset);//光标相对于该网页的水平位置
console.log(screenX);//光标相对于电脑屏幕的水平位置
}
</script>