Language References
Retrieves the object’s scrolling width.
HTML |
N/A |
Script |
[ iWidth = ] object.scrollWidth |
iWidth |
Nonnegative integer value representing the width, in pixels. |
The property is read-only with no default value.
The width is the distance between the left and right edges of the object’s visible content.
For more information on how to access the dimension and location of objects on the page through the document object model, see Measuring Element Dimension and Location.
The following example shows a possible application of the scrollWidth property. In the example, the DIV's nowrap attribute is set, thereby keeping disabling wrapping of the text.
<head>
<script language="JavaScript">
<!--
function chkScrollWidth ( ) {
var objWidth = theObj.scrollWidth;
alert ( "The value of the scrollWidth property is " +
objWidth + " pixels" );
}
//-->
</script>
</head>
<body>
<div id="theObj" style="overflow:auto;
height:50; width:200; text-align:left;
background:khaki" nowrap>The scrollWidth property ...
</div>
<br>
<input type=button value="Check scrollWidth"
onclick="chkScrollWidth ( )"></div>
</body>
This feature requires Internet Explorer® 4.0 or later.
Show me
scrollHeight, scrollLeft, scrollTop, width