编辑下面的代码:【加编码】
<html> <head> <script> function coordinates(event) { var x=event.screenX; var y=event.screenY; alert("X=" + x + " Y=" + y); } </script> </head> <body> <p onmousedown="coordinates(event)"> Click this paragraph, and an alert box will alert the x and y coordinates of the cursor, relative to the screen. </p> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂