JavaScript Reference/Javascript Properties/scrollWidth
"scrollWidth" Example
<source lang="javascript">
<html> <body> <script language="JavaScript"> function function2() {
mySH.innerHTML = myDiv.scrollHeight; mySW.innerHTML = myDiv.scrollWidth;
} </script>
Scroll Height: 0
Scroll Width: 0
<img src="yourimage.gif">
</body> </html>
</source>
"scrollWidth" is applied to
<source lang="javascript">
+----------------+--------------------------------------------------------------+ | Applied_To |<a> <acronym> | | |<address> <applet> | | |<area> | | |<base> <basefont> | | | |
| |<body> || |
| |
<button> || | |
| |<dir>| | |<col> <colgroup> | | |<custom>
| | | || | |
- | | | <embed> | | |<fieldset> <form> | | |<frame> <frameset> | | |<head> <hn> | | |
<html> || | <iframe> | | |<img> <input> | | |<input type="button"> <input type="checkbox"> | | |<input type="file"> <input type="image"> | | |<input type="password"> <input type="radio"> | | |<input type="reset"> <input type="submit"> | | |<input type="text"> | | |<isindex> | | |<label> <legend> |
| |- <link> | | |<listing> <map> | | |<marquee> <menu> | | |<meta> <nobr> | | |<noframes> <noscript> | | |<object>
| | |<optgroup> <option> | | |
<param> | | |<plaintext>
| | || | | <script> | | |<select> | | || | | <style> | | | | | |<tbody> | | |
<textarea> | | |<tfoot> | | |<thead> <title> |
| || | | | | | <xmp> | +----------------+--------------------------------------------------------------+ </source>
"scrollWidth" Syntax and Note
<source lang="javascript"> Note: Read-only properties. Return the element"s total width.
Syntax:
document.all.getElementById("elementID").scrollHeight document.all.elementID.scrollHeight // IE only document.all.getElementById("elementID").scrollWidth document.all.elementID.scrollWidth // IE only
</source>