Javascript Reference
Categories: Obj_Button

javascript Obj_Button scrollHeight, scrollWidth

@March 15, 2008, 1:22 a.m.
scrollHeight, scrollWidthFirefox/Netscape/NN 7 IE 4 Chrome/Safari/DOM n/a  

Read-only  

Originally implemented in IE 4 for elements that either scrolled or influenced an element's scroll (body, button, caption, div, fieldset, legend, marquee, and textarea), these properties return the pixel dimensions of an element, including elements that are larger than the viewable area in the browser window. This is in contrast to the clientHeight and clientWidth properties for scrollable elements, which return dimensions of only visible portions of the element. IE for the Macintosh, however, interprets the intent of the scroll- properties differently, returning the dimensions of the visible portion.

 

Starting in IE 5 for Windows, all HTML elements have these properties, and the values for nonscrolling elements are the same as the offsetHeight and offsetWidth properties. Netscape 7 implements these properties for all elements, returning the height and width of the element, whether or not it's in view. The important point is that for key elements, such as the body, the properties mean different things and can disrupt cross-platform operation.

 
Example
 
var midPoint = document.body.scrollHeight/2;
 
Value

Positive integer or zero.

 
Default

None.


Powered by Linode.