The tabIndex PropertyYou 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
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. |