Javascript Reference
Categories: Element

javascript Element offsetParent

@March 25, 2009, 3:44 a.m.
offsetParent Firefox/Netscape/NN 6 IE 4 Chrome/Safari/DOM n/a  

 

Read-only  
 

Returns a reference to the object that is the current element's offset positioning context. For most elements on an IE page and all elements in a Netscape 6 page, this is the body object. But elements in IE that are wrapped in div elements or are cells of a table have other parents. Moreover, for complex nested elements, you will find wide variations in the object returned by this property, depending on browser version. For example, the offsetParent property of a td element is the next outermost tr element in IE 4 for Windows, and the table element for later versions of IE for Windows and all versions of IE for the Macintosh. Netscape 6 still regards the body element as the offsetParent of the td element.

 
Example
 
var containerLeft = document.getElementById("elementID").offsetParent.offsetLeft;
 
Value

Object reference.

 
Default

body object.


Powered by Linode.