x
 
<!DOCTYPE html>
<html>
<body>
<h2 onclick="showCoords(event)">请单击此标题可获取鼠标指针相对于屏幕的 x(水平)和 y(垂直)坐标,当它被点击时。</h2>
<p><b>提示:</b>请尝试单击标题中的不同位置。</p>
<p id="demo"></p>
<script>
function showCoords(event) {
  var x = event.screenX;
  var y = event.screenY;
  var coords = "X coords: " + x + ", Y coords: " + y
  document.getElementById("demo").innerHTML = coords;
}
</script>
</body>
</html>