136 Part (Make my own web site) III .Document Objects Reference because they
Saturday, September 15th, 2007136 Part III .Document Objects Reference because they are convenient for some scriptable Dynamic HTML tasks. Through these two properties, a script can read the height and width of any block-level or inline element. As with IE, the NN6 offsetWidth of a text-oriented block-level element is the width of the element s container. For example, a P element consisting of only a few words may report an offsetWidthof many hundreds of pixels because the paragraph s block extends the full width of the BODY element that represents the containing parent of the P element. Example on the CD-ROM Related Items: clientHeight, clientWidth properties. offsetLeft offsetTop Value: Integer Read-Only NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5 Compatibility The offsetLeft and offsetTopproperties can suffer from the same version vagaries that afflict offsetHeight and offsetWidthproperties when borders, margins, and padding are associated with an element. However, the offsetLeft and offsetTop properties are valuable in providing pixel coordinates of an element within the positioning context of the parent element even when the elements are not positioned explicitly. The offsetLeft and offsetTop properties for positioned elements in IE/Macintosh do not return the same values as the style.leftand style.top properties of the same element. See Listing 31-17 for an example of how to correct these discrepancies without having to hard-wire the precise pixel differences in your code. The element used as a coordinate context for these properties is whatever element the offsetParent property returns. This means that to determine the precise position of any element, you may have to add some code that iterates through the offsetParenthierarchy until that property returns null. Although the offsetLeft and offsetTopproperties are not part of the W3C DOM specification, Netscape has implemented these properties in NN6 because they are convenient for some scriptable Dynamic HTML tasks. Through these two properties, a script can read the pixel coordinates of any block-level or inline element. Measurements are made relative to the BODY element, but this may change in the future. See the discussion later in this chapter about the offsetParentproperty. Note On the CD-ROM elementObject.offsetLeft
We recommend cheap and reliable webhost to host and run your web applications: Coldfusion Web Hosting services.