Get the position of a div/span tag
Posted
by schmoopy
on Stack Overflow
See other posts from Stack Overflow
or by schmoopy
Published on 2008-11-13T23:07:16Z
Indexed on
2010/05/05
2:28 UTC
Read the original article
Hit count: 268
Can someone show me how to get the .top & .left position of a div or span tag when one is not specified?
ie:
<span id='11a' style='top:55px;' onmouseover="GetPos(this);">stuff</span>
<span id='12a' onmouseover="GetPos(this);">stuff</span>
In the above, if i do:
document.getElementById('11a').style.top
The the value of 55px is returned. However if i try that for span '12a', then nothing gets returned. I have a bunch of div/spans on a page that i cannot specify the top/left properties for, but i need to display a div directly under that element.
Thanks for lookin :-)
© Stack Overflow or respective owner