Name
scrollLeft, scrollTop — NN n/a IE 4 DOM n/a
Synopsis
Read/Write
The distance in pixels between the actual left or top edge of the
element’s physical content and the left or top edge of the
visible portion of the content. Setting these properties allows you
to use a script to adjust the scrolling of content within a
scrollable container, such as text in a TEXTAREA
element or an entire document in the browser window or frame. When
the content is not scrolled, both values are zero. Setting the
scrollTop
property to 15 scrolls the document
upward by 15 pixels in the window; the scrollLeft
property is unaffected unless explicitly changed. The property values
change as the user adjusts the scrollbars.
Example
document.all.myButton.scrollTop = 40
Value
Positive integer or zero.
Default
0
Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.