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