This page is In Progress

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

scrollHeight

Property of dom/HTMLElementdom/HTMLElement

Syntax

var result = element.scrollHeight;
element.scrollHeight = value;

Examples

This example uses the scrollHeight property to retrieve the height of the viewable content.

<script type="text/javascript">
function fnCheckScroll(){
    var iNewHeight = oDiv.scrollHeight;
    alert("The value of the scrollHeight property is: "
        + iNewHeight + "px");
}
</script>
...
<div id="oDiv" style="overflow: scroll; height= 100px; width= 250px; text-align: left">
    ...
</div>
<button onclick="fnCheckScroll()">Check scrollHeight</button>

View live example

Notes

Remarks

The height is the distance between the top and bottom edges of the object’s content. This property is read-only on HTML documents, and read-write on fixed regions. For more information about how to access the dimension and location of objects on the page through the Dynamic HTML (DHTML) Object Model, see Measuring Element Dimension and Location with CSSOM in Internet Explorer 9.

Syntax

Attributions