Scrollwidth
It is the width of the actual content of the object. The width of the content in the object varies with the number of elements in the object. If the content is too large, the actual width of the object may be changed ).
Clientwidth
It is the visible width of the object. If it is not set to the same side of the scroll bar, it will change with the display size of the window.
Offsetwidth
Is the visible width of the object. The package's scroll bar and other edges change with the display size of the window.
An example of scrollwidth and clientwidth:
<HTML>
<Head>
<Title> 77.htm file </title>
</Head>
<Body>
<Textarea wrap = "off" onfocus = "alert ('rollwidth: '+ this. scrollwidth +' \ n clientwidth: '+ this. clientwidth);"> </textarea>
</Body>
</Html>
Enter the content in the text box. The value of scrollwidth and clientwidth is the same before the horizontal scroll bar does not come out. When a row of content exceeds the width of the text box, a horizontal scroll bar is displayed, and the value of scrollwidth is changed.
Scrollwidth is the width of the object content.
Clientwidth is the width (excluding the edge) seen by the object, which will not be changed in this example.
example of clientwidth and offsetwidth:
77.htm file
the value of offsetwidth is always greater than that of clientwidth.
clientwidth indicates the width (excluding edges) of the object.
offsetwidth indicates the width (including edges, such as the width occupied by the scroll bar) of the object.