相对于屏幕的光标坐标是什么?

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script>
  5. function coordinates(event) {
  6. document.getElementById("demo").innerHTML = "X = " + event.screenX + "<br>Y = " + event.screenY;
  7. }
  8. </script>
  9. </head>
  10. <body>
  11.  
  12. <img src ="/i/eg_planets.jpg" alt="Planets"
  13. onmousedown="coordinates(event)" />
  14.  
  15. <p>单击上面的图片可显示鼠标指针相对于屏幕的 x 和 y 坐标。</p>
  16.  
  17. <p id="demo"></p>
  18.  
  19. </body>
  20. </html>