Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q450 How can I scroll the current page or a page in another frame?

You are here: irt.org | FAQ | JavaScript | Scroll | Q450 [ previous next ]

In Netscape Navigator 3 you can use the window.scroll(x,y) method to do this.

In Netscape Navigator 4 this has been deprecated and replaced with window.scrollTo() and window.scrollBy():

scrollBy(horizontal, vertical)

horizontal - The number of pixels by which to scroll the viewing area horizontally.
vertical - The number of pixels by which to scroll the viewing area vertically.

scrollTo(x-coordinate, y-coordinate)
x-coordinate - An integer representing the x-coordinate of the viewing area in pixels.
y-coordinate - An integer representing the y-coordinate of the viewing area in pixels.

To scroll another frame you need to go via the parent frame, e.g.:

parent.frameName.scrollTo(0,500)

which will scroll the frame frameName to 500 pixels from the top of the document.

To see how to do this in a cross-browser fashion see: Instant JavaScript - Automated Scrolling.

Feedback on 'Q450 How can I scroll the current page or a page in another frame?'

©2018 Martin Webb