JS obtain the coordinates of the mouse through onMouseMove and onmouseout

From , 5 Years ago, written in JavaScript, viewed 118 times.
URL https://pastebin.vip/view/ffa9b486
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script>
  5. function myFunction(e)
  6. {
  7. x=e.clientX;
  8. y=e.clientY;
  9. coor="Coordinates: (" + x + "," + y + ")";
  10. document.getElementById("demo").innerHTML=coor
  11. }
  12.  
  13. function clearCoor()
  14. {
  15. document.getElementById("demo").innerHTML="";
  16. }
  17. </script>
  18. </head>
  19. <body style="margin:0px;">
  20.  
  21. <div id="coordiv" style="width:199px;height:99px;border:1px solid" onmousemove="myFunction(event)" onmouseout="clearCoor()"></div>
  22.  
  23. <p>Mouse over the rectangle above, and get the coordinates of your mouse pointer.</p>
  24.  
  25. <p id="demo"></p>
  26.  
  27. </body>
  28. </html>
  29.  
  30. //javascript/7967

Reply to "JS obtain the coordinates of the mouse through onMouseMove and onmouseout"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website