Scrollheight: gets the scroll height of an object.
Scrollleft: sets or obtains the distance between the left-side border of the object and the leftmost end of the currently visible content in the window.
Scrolltop: sets or obtains the distance between the top of the object and the top of the visible content in the window.
Scrollwidth: gets the scroll width of an object.
Offsetheight: gets the height of an object relative to the layout or the parent coordinate specified by the parent coordinate offsetparent attribute.
Offsetleft: obtains the left position of the object relative to the layout or the parent coordinate specified by the offsetparent attribute.
Offsettop: obtains the top position of an object relative to the layout or the parent coordinate specified by the offsettop attribute.
The horizontal coordinates of event. clientx relative to the document
The vertical coordinates of event. clienty relative to the document
Horizontal coordinates of event. offsetx relative to the container
Event. offsety vertical coordinates of the container
Document.doc umentelement. scrolltop vertical scroll Value
Event.clientxw.document.doc umentelement. The horizontal coordinate of scrolltop relative to the document + The amount of vertical scrolling
The difference between Firefox and IE is as follows:
Ie6.0, ff1.06 +:
Clientwidth = width + padding
Clientheight = height + padding
Offsetwidth = width + padding + border
Offsetheight = height + padding + border
Ie5.0/5.5:
Clientwidth = width-border
Clientheight = height-border
Offsetwidth = width
Offsetheight = height
(The margin attribute in CSS is independent of clientwidth, offsetwidth, clientheight, and offsetheight) <textarea id="runcode29609"></textarea> Xmlns = "http://www.w3.org/1999/xhtml" lang = "gb2312"> <title><Br/> <SPAN class = 'wp _ keywordlink '> Code </span> example: test and comparison of clientwidth, offsetwidth, clientheight, and offsetheight <br/></title>
Click the following link:
Getclientwidth ();
Getclientheight ();
Getoffsetwidth ();
Getoffsetheight ();
Ie6.0, ff1.06 +:
Clientwidth = width + padding = 300 + 10 × 2 = 320
Clientheight
= Height + padding = 200 + 10 × 2 = 220
Offsetwidth = width +
Padding + border = 300 + 10 × 2 + 10 × 2 = 340
Offsetheight = height
+ Padding + border = 200 + 10 × 2 + 10 × 2 = 240
Ie5.0/5.5:
Clientwidth = width-border = 300-10 × 2 = 280
Clientheight
= Height-border = 200-10 × 2 = 180
Offsetwidth = width =
300
Offsetheight = height = 200