光标的坐标是什么?

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