scrollIntoViewscrollIntoView*
*



Contents  *



Index  *Topic Contents
*Previous Topic: scrollBy
*Next Topic: scrollTo

scrollIntoView

Description

Causes the object to scroll into view, aligning it at either the top or bottom of the window.

Syntax

object.scrollIntoView([start])

ParameterDescription
start Optional. Boolean value specifying whether to place the object at the top of the window or at the bottom. If TRUE, the method causes the object to scrolls so that its top is visible at the top of the window. If FALSE, the bottom of the object is visible at the bottom of the window. If no value is given, the object scrolls to the top by default.

Return Value

No return value.

Remarks

The following example causes the element to scroll into view within the window, placing it at either the top or bottom of the window. The method is useful for immediately showing the user the result of some action without requiring the user to manually scroll through the document to find the result. This example underlines the content of the fifth paragraph and scrolls it into view at the top of the window.

var coll = document.all.tags("P");
if (coll.length>=5) {
    coll(4).style.textDecoration = "underline";
    coll(4).scrollIntoView(true);
}

Depending on the size of the given object and the current window, this method might not be able to put the item at the very top or very bottom, but will always position the object as close to the requested position as possible.

Applies To

A, ADDRESS, APPLET, AREA, B, BIG, BLOCKQUOTE, BR, BUTTON, CAPTION, CENTER, CITE, CODE, COL, COLGROUP, COMMENT, DD, DFN, DIR, DIV, DL, DT, EM, EMBED, FIELDSET, FONT, FORM, H1, H2, H3, H4, H5, H6, HR, I, IFRAME, IMG, INPUT, KBD, LABEL, LEGEND, LI, LISTING, MAP, MARQUEE, MENU, OBJECT, OL, P, PLAINTEXT, PRE, S, SAMP, SELECT, SMALL, SPAN, STRIKE, STRONG, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, TH, THEAD, TR, TT, U, UL, VAR, WBR, XMP, TextRange


Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.