实例代码“Ctrl+/”提示“F11/ESC”全屏 返回 格式化 恢复 运行
x
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<script>
5
function show_coords(event)
6
{
7
var x=event.clientX;
8
var y=event.clientY;
9
alert("X coords: " + x + ", Y coords: " + y);
10
}
11
</script>
12
</head>
13
14
<body>
15
16
<p onmousedown="show_coords(event)">请在文档中点击。一个消息框会提示出鼠标指针的 x 和 y 坐标。</p>
17
18
</body>
19
</html>
20