asp.net.ph

Skip Navigation Links

scrollWidth Property

Language References


Retrieves the object’s scrolling width.

Syntax


HTML N/A
Script [ iWidth = ] object.scrollWidth

Possible Values


iWidth Nonnegative integer value representing the width, in pixels.

The property is read-only with no default value.

Remarks

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.

Example

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 

See Also

scrollHeight, scrollLeft, scrollTop, width



>

© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note