On Mouse Move 1
RUN
<!DOCTYPE html> <html> <head> <title>On Mouse Move</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <div style="height: 500px; background: blue" onmousemove="showCoordinates(event)"> </div> <p>Tọa độ X: <span id="x"></span> - Tọa độ Y: <span id="y"></span></p> <script> function showCoordinates(e){ var x = e.clientX; var y = e.clientY; document.getElementById("x").innerHTML = x; document.getElementById("y").innerHTML = y; } </script> </body> </html>
PHÓNG TO