Click to See Complete Forum and Search --> : getiing an objects position


amdRocks
02-03-2003, 08:36 PM
Hi guys,
I have a page on which I have several images which are layed out using tables.
first a main table,this tables tr consists of another table and this table eventually have a td that has an image.
I know the width and height of images.
Main tables alignment is set to centre,therefore when window size is increased or reduced the layout is automatically adjusted.
Question is
At any given point( since all the settings are relative) how do I get the images distance from the left edge of the browser window,or top edge of the browser window.I have used object.offsetLeft but it gives me the distance from the immidiate parent,which in this case is a td,hence the result is always 0.

Thanks for help.

Nedals
02-03-2003, 09:59 PM
Go here. There a tutorial that explains the the problem.

http://webreference.com/dhtml/

Element Page Coordinates, Part 4 IE4+ NS6+

khalidali63
02-03-2003, 10:23 PM
Thanks nedals,thought I'd already found the offsetParent emthod,I appreciate the link.It actually describes exactly what I am trying to do.

Nedals
02-04-2003, 12:28 AM
If I recall correctly, this tutorial does not work for NS4xx.
You may already know this, but simply use...

Y = elementObj.y;
X = elementObj.x;

amdRocks
02-04-2003, 01:07 PM
Well here is the next part of this question.
While going through some docs,I've found out that elementReference.offsetLeft/Top are the non-standard properties,hence I think they will not work in IE 5+ for MAC since MAC IE is more standard compliant then IE Windows.
Can I get some help to find some other
way to get the same coords that offsetLeft/Top will give by using any other property method?