The tabIndex Property


The tabIndex Property

You can let the user move from element to element in your web page just by pressing the Tab key. When you do, the focus moves from element to elementand using the tabIndex property, you can specify the tab order of elements in a page. You can find the support for this property in Table 5.55.

Table 5.55. The tabIndex Property

Property

NS2

NS3

NS4

NS6

IE3a

IE3b

IE4

IE5

IE5.5

IE6

tabIndex

     

x

   

x

x

x

x

 

Read/Write

 

Type: Integer

Here's an example where I'm rearranging the tab order of three text fields in a web page:

(Listing 05-22.html on the web site)
 <HTML>      <HEAD>          <TITLE>              Using the tabIndex Property          </TITLE>      </HEAD>      <BODY>              <H1>                  Using the tabIndex Property              </H1>          <INPUT TYPE="TEXT" NAME="text1">          <INPUT TYPE="TEXT" NAME="text2">          <INPUT TYPE="TEXT" NAME="text3">          <SCRIPT LANGAUGE="JavaScript">              <!--  document.all.text1.tabIndex = 2   document.all.text2.tabIndex = 1   document.all.text3.tabIndex = 0  // -->          </SCRIPT>      </BODY>  </HTML> 

When the user presses the Tab key repeatedly, the focus moves from the element with tab index 0 to the element with tab index 1, then tab index 2, and so on.



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