实例代码“Ctrl+/”提示“F11/ESC”全屏 返回 格式化 恢复 运行
x
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
5
<script type="text/javascript">
6
function coordinates(event)
7
{
8
x=event.screenX
9
y=event.screenY
10
alert("X=" + x + " Y=" + y)
11
}
12
13
</script>
14
</head>
15
<body onmousedown="coordinates(event)">
16
17
<p>
18
在文档中点击某个位置。消息框会提示出指针相对于屏幕的 x 和 y 坐标。
19
</p>
20
21
</body>
22
</html>
23