x
1
2
<html>
3
<head>
4
<meta charset="utf-8">
5
<title>蜜蜂教程(mifengjc.com)</title>
6
<script type="text/javascript">
7
function coordinates(event) {
8
x = event.screenX
9
y = event.screenY
10
alert("X=" + x + " Y=" + y)
11
}
12
</script>
13
</head>
14
<body onmousedown="coordinates(event)">
15
16
<p>
17
在文档中点击某个位置。消息框会提示出指针相对于屏幕的 x 和 y 坐标。
18
</p>
19
20
</body>
21
</html>