W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html> <head> <script> function coordinates(event) { document.getElementById("demo").innerHTML = "X = " + event.screenX + "<br>Y = " + event.screenY; } </script> </head> <body> <img src ="/i/eg_planets.jpg" alt="Planets" onmousedown="coordinates(event)" /> <p>单击上面的图片可显示鼠标指针相对于屏幕的 x 和 y 坐标。</p> <p id="demo"></p> </body> </html>