The scrollIntoView Method


The scrollIntoView Method

The 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

Method

NS2

NS3

NS4

NS6

IE3a

IE3b

IE4

IE5

IE5.5

IE6

scrollIntoView([ top ])

           

x

x

x

x

 

No return value

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> 


Inside Javascript
Inside JavaScript
ISBN: 0735712859
EAN: 2147483647
Year: 2005
Pages: 492
Authors: Steve Holzner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net