The parent object whose position provides a datum for the element to be offset away from.
This could refer to the document object for the current window. In many cases it will be the BODY object for the document. However you may have used <TABLE> tags to control the layout and these might be the parent objects for the content of the table while the parent of the TABLE objects would be the BODY object.
The parent-child hierarchy of element objects within the document is dependent on how you construct it when the document source is authored.
This is not the same as the parentElement property. That property reflects the true document hierarchy in all its fine detail. The offsetParent property reflects the spatial relationships between objects. Objects that show up in the parentElement hierarchy will likely be omitted from the offsetParent hierarchy model on account of them not contributing any spatial offset to the contained elements.
The offset properties are implemented very inconsistently across platforms and versions of MSIE. Use them with caution. In any case, they are available for read access only so they are of limited use in position control.
Prev | Home | Next |
Element.offsetLeft | Up | Element.offsetTop |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |