代码示例:(标识:eg_js_events_clientxy)
<!DOCTYPE html>
<html>
<head>
<script>
function show_coords(event) {
  document.getElementById("demo").innerHTML = "X= " + event.clientX + "<br>Y= " + event.clientY;
}
</script>
</head>

<body>

<img src ="/static/demo/images/eg_planets.jpg" alt="Planets" 
onmousedown="show_coords(event)" />

<p>单击上面的图片可显示鼠标指针的 x 和 y 坐标。</p>

<p id="demo"></p>

</body>
</html>
运行结果: