代码示例:(标识:dhtm_xycursor)
<html>
<head>
<script type="text/javascript">
function show_coords(event)
{
x=event.clientX
y=event.clientY
alert("X 坐标: " + x + ", Y 坐标: " + y)
}
</script>
</head>

<body onmousedown="show_coords(event)">
<p>请在文档中点击。提示框会显示出指针的 x 和 y 坐标。</p>
</body>

</html>
运行结果: