[JavaScript] JS鼠标点击时获取鼠标所在位置的坐标值 →→→→→进入此内容的聊天室

来自 , 2019-08-16, 写在 JavaScript, 查看 101 次.
URL http://www.code666.cn/view/33b3214d
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script>
  5. function show_coords(event)
  6. {
  7. var x=event.clientX;
  8. var y=event.clientY;
  9. alert("X coords: " + x + ", Y coords: " + y);
  10. }
  11. </script>
  12. </head>
  13.  
  14. <body>
  15.  
  16. <p onmousedown="show_coords(event)">Click this paragraph, and an alert box will alert the x and y coordinates of the mouse pointer.</p>
  17.  
  18. </body>
  19. </html>
  20.  
  21. //javascript/7971

回复 "JS鼠标点击时获取鼠标所在位置的坐标值"

这儿你可以回复上面这条便签

captcha