...

View Full Version : Getting the horizontal position of an object..?



pvz
08-10-2004, 08:53 AM
I use...
document.all[img].offsetTop
...to get the verticalposition of an image.
Q: What do I use to get the horizontal position? I tried what I thought was the obvious:
document.all[img].offsetLeft
...but it didn't work. Hope you can help, thanks/Per

Kor
08-10-2004, 10:50 AM
object.offsetLeft should work. But be careful, offsetTop and offsetLeft are relative position indicators. If your object is nested, the values are relative to the nesting object.

How does your object looks like?

(I suggest you to use document.getElementById(id) method instead of document.all)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum