javascript - Show X and Y coordinates? -
i not sure of how start 1 off. either way, want show x , y coordinates on webpage when mouse moves on page. has work browser.
heres html code:
<!doctype html> <html> <head> <meta charset="utf-8"> <title>coordinates</title> <link rel="stylesheet" type="text/css" href="style.css"> <script src="script.js"></script> </head> <body> <div id="center"> <h1>mouse coordinates</h1> <p>x-coordinate: </p><p id="xcord">0</p> <p>y-coordiante: </p><p id="ycord">0</p> </div> </body> </html>
css file:
#center{ margin: 0 auto; width: 500px; }
javascript file:
not much, not sure start off...
window.onload = init; function init(e) { }
basically need document.addeventlistener('mousemove', mousemover, false); references function - mouseover() - clientx , clienty. there need set innerhtml of 2 p elements values.
Comments
Post a Comment