Javascript Reference
Categories: BODY

javascript BODY scrollHeight, scrollWidth

@Aug. 28, 2008, 5:30 a.m.
scrollHeight, scrollWidth Firefox/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 BODY 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.

To the gakaa.com owner, You always provide in-depth analysis and understanding.
Madeline Townson - 5 days
This article had to take you a lot of research time. I am impressed with the formatting and content.
Sewing equipment - 2014-05-06

Powered by Linode.