Javascript Reference
Categories: TABLE

javascript TABLE scrollLeft, scrollTop

@July 12, 2008, 5:50 a.m.
scrollLeft, scrollTop Firefox/Netscape/NN 7 IE 4 Chrome/Safari/DOM n/a  

Provide the distance in pixels between the actual left or top edge of the TABLE element's physical content and the left or top edge of the visible portion of the TABLE 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. This is important for some event-driven positioning tasks in IE for Windows because the coordinate system for event offset measurements are with respect to the visible area of a page in the browser window. You must add document.body scrolling factors to align event coordinates with body content positions . Starting with IE 5 for Windows, the scrollLeft and scrollTop properties are available for all HTML element objects, but values for unscrollable elements are zero.

document.body.scrollTop = 40;

Positive integer or zero.



Powered by Linode.