Is there a way of getting the x/y of any div using javascript? Could anyone link me to a tutorial or code me something quickly.
Thanks
Danny

Is there a way of getting the x/y of any div using javascript? Could anyone link me to a tutorial or code me something quickly.
Thanks
Danny
Doesnt work on Firefox, sadly.
Meh i found this but it seems like a lousy way of doing it:
http://www.howtocreate.co.uk/emails/DavidBerman.html
Its easy to do via the DOM. How are you positioning the div to stat with though? Absoulte? relative? etc?
If by css you may use for example.
You could get the values by.Code:<style> #box { position:absolute; left:50px; top:20px; } </style> <div id="box"></div>
topval = document.getElementById('box').style.top;
leftval = document.getElementById('box').style.left;
Using your method Entor, how would you then go on to echo out the values?
Want to hide these adverts? Register an account for free!