scrollTop Property Sample

Click anywhere inside the box to get the scrollTop value.
The text in this box has been placed inside a span that is wider (250px) than the div that encapsulates the it (the div has a width of only 200px). The overflow is set to scroll. Because the length of the text is greater than the div element's area, horizontal and vertical scrolling are forced. Click anywhere in the box to obtain the amount of scrolling from the top the text has done.



[Right-click and choose View Source from the shortcut menu.]

© 2007 Microsoft Corporation. All rights reserved. Terms of use.