光标的坐标是什么?
- <!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 ="/i/eg_planets.jpg" alt="Planets"
- onmousedown="show_coords(event)" />
- <p>单击上面的图片可显示鼠标指针的 x 和 y 坐标。</p>
- <p id="demo"></p>
- </body>
- </html>