Run ❯
Get your
own
website
❯
Run Code
Ctrl+Alt+R
Save Code
Ctrl+Alt+A
Change Orientation
Ctrl+Alt+O
Change Theme
Ctrl+Alt+D
Go to Spaces
Ctrl+Alt+P
<!DOCTYPE html> <html> <head> <style> div { width: 200px; height: 100px; border: 1px solid black; } </style> </head> <body> <h1>Mouse Events</h1> <h2>The pageX and pageY Properties</h2> <div onmousemove="showCoords(event)" onmouseout="clearCoor()"></div> <p>Mouse over the rectangle above to get the horizontal and vertical coordinates of your mouse pointer.</p> <p id="demo"></p> <script> function showCoords(event) { var x = event.pageX; var y = event.pageY; var coor = "X coords: " + x + ", Y coords: " + y; document.getElementById("demo").innerHTML = coor; } function clearCoor() { document.getElementById("demo").innerHTML = ""; } </script> </body> </html>