16.11 Controlling Tab Order
HTML 4.0 defines a TABINDEX attribute that can be used in any of the visual HTML elements. Its value is an integer, and it controls the order in which elements receive the input focus when the TAB key is pressed. Unfortunately, however, it is supported only by Internet Explorer. Nevertheless, you can use TABINDEX even for pages that will be viewed by multiple browsers, as long as the designated tabbing order is a convenience to the user, not a necessity for proper operation of the page.
As of version 4.7, Netscape does not support the TABINDEX attribute.
Listing 16.8 Tabindex.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE>Controlling TAB Order</TITLE> </HEAD> <BODY BGCOLOR="#FDF5E6"> <H2 ALIGN="CENTER">Controlling TAB Order</H2> <FORM ACTION="http://localhost:8088/SomeProgram"> Field 1 (first tab selection): <INPUT TYPE="TEXT" NAME="field1" TABINDEX=1><BR> Field 2 (third tab selection): <INPUT TYPE="TEXT" NAME="field2" TABINDEX=3><BR> Field 3 (second tab selection): <INPUT TYPE="TEXT" NAME="field3" TABINDEX=2><BR> </FORM> </BODY> </HTML>
Figure 1626 In Internet Explorer, repeatedly pressing the TAB key cycles the input focus among the first, third, and second text fields, in that order (as dictated by TABINDEX). In Netscape, the input focus would cycle among the first, second, and third fields, in that order (based on the order the elements appear on the page).