The scrollIntoView MethodThe scrollIntoView method causes an object to scroll into view in the Internet Explorer, aligning it either at the top or bottom of the window as you specify. You can see the support for this method in Table 6.46. Table 6.46. The scrollIntoView Method
If the top argument is true, the top of the object is aligned to the top of the browser's client area; if it's false, the bottom of the object is aligned to the bottom of the browser's client area. Here's an example that uses scrollIntoView to scroll a text field into view: (Listing 06-10.html on the web site)<HTML> <HEAD> <TITLE>Using the scrollIntoView Method</TITLE> <SCRIPT LANGUAGE="JavaScript"> <!-- function scroller() { document.form1.text1.scrollIntoView(false) } // --> </SCRIPT> </HEAD> <BODY> <H1>Using the scrollIntoView Method</H1> <FORM NAME="form1"> <INPUT TYPE="BUTTON" ONCLICK="scroller()" VALUE="Scroll Text Field"></INPUT> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <INPUT TYPE="TEXT" ID="text1" SIZE="50" VALUE="Hello"></INPUT> </FORM> </BODY> </HTML> |