PDA

View Full Version : offset


influx
14.02.2002, 06:59
More simplistic questions....

I'm using offsetLeft and offsetTop to get the position of a relatively positioned element on screen. this works fine, unless the element is the child of another element (a table for instance), in which case offsetLeft/Top return values relative to the parent element - a td in a table.

I need to get the absolute values of top and left for the element. Short of looping through all potential parent elements and getting their respective offsetLeft/offsetTop values and calculating from there, is there any way to get these values from an element thats nested in a table?

Icestorm
14.02.2002, 08:03
Actually, there is nothing else. Just loop through the offsetParents and add their offset values.