TABINDEX Attribute | tabIndex Property

MS Office DHTML, HTML & CSS

TABINDEX Attribute | tabIndex Property


Sets or retrieves the index within the tab selection order of the object.

Syntax

HTML<ELEMENT TABINDEX = iIndex ... >
Scriptingobject.tabIndex [ = iIndex ]

Possible Values

iIndexNon-negative integer that specifies the tab index. To remove the object from the tab selection order, use -1.

The property is read/write with no default value.

Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see dynamic propertiesInternet Link.

Remarks

The tabIndex value determines tab selection order as follows:

  1. All objects with a tabIndex greater than 0 are selected in increasing tab index order, or all objects with duplicate tabIndex values are selected in source order.
  2. All objects with a tabIndex equal to 0, or without tabIndex set, are selected next, in source order.
  3. Elements with a negative tabIndex are omitted from the tabbing order.

The valid range of values for the tabIndex property is -32767 to 32767.

The following elements can have focus and are tab stops by default: A, BODY, BUTTON, EMBED, FRAME, IFRAME, IMG, INPUT, ISINDEX, OBJECT, SELECT, TEXTAREA.

The following elements can have focus by default but are not tab stops; however, they can be set as tab stops: APPLET, DIV, FRAMESET, SPAN, TABLE, TD.

You can set the THEAD and TFOOT elements to participate in the tabbing sequence, but they do not highlight when receiving focus.

As of Internet Explorer 5, scoped elements support the tabIndex property and can have focus. These elements are not tab stops and do not have focus by default. Setting the tabIndex property to a valid positive integer makes the element a tab stop. The element can have focus if the tabIndex property is set to any valid negative or positive integer.

Elements that receive focus can fire the onblur and onfocus events as of Internet Explorer 4.0, and the onkeydown, onkeypress, and onkeyup events as of Internet Explorer 5.

Example

Sample Code

This example uses the tabIndex property to specify the tab order for three text fields, and removes the Submit button from the tab order by specifying a negative value.

<INPUT TYPE="text" TABINDEX="1">
<INPUT TYPE="text" TABINDEX="3">
<INPUT TYPE="text" TABINDEX="2">
<INPUT TYPE="submit" TABINDEX="-1">
This feature requires Microsoft® Internet Explorer 4.0 or later. Click the icon below to install the latest version. Then reload this page to view the sample.
Microsoft Internet Explorer

This example uses the tabIndex property to assign a tab order to an unordered list. To cycle through the list's tab order, the user presses the TAB key. Since the list items can have focus, the focus rectangle surrounds each each item the user selects.

<UL>
  <LI TABINDEX="1">Item 1
  <LI TABINDEX="2">Item 2
  <LI TABINDEX="3">Item 3
  <LI TABINDEX="4">Item 4
  <LI TABINDEX="5">Item 5
</UL>
This feature requires Microsoft® Internet Explorer 5 or later. Click the icon below to install the latest version. Then reload this page to view the sample.
Microsoft Internet Explorer

Applies To

[ Object Name ]
PlatformVersion
Win16:
Win32:
Mac:
Unix:
WinCE:
Version data is listed when the mouse hovers over a link, or the link has focus.
A, ACRONYM, ADDRESS, APPLET, AREA, B, BDO, BIG, BLOCKQUOTE, BODY, BUTTON, CAPTION, CENTER, CITE, custom, DD, DEL, DFN, DIR, DIV, DL, DT, EM, EMBED, FIELDSET, FONT, FORM, FRAME, FRAMESET, Hn, HR, I, IFRAME, IMG, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, INS, ISINDEX, KBD, LABEL, LEGEND, LI, LISTING, MARQUEE, MARQUEE, MENU, OBJECT, OL, P, PLAINTEXT, PRE, Q, RT, RUBY, S, SAMP, SELECT, SMALL, SPAN, STRIKE, STRONG, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, TH, THEAD, TR, TT, U, UL, VAR, XMP

Back to topBack to top

Did you find this topic useful? Suggestions for other topics? write us!Internet Link

© 1999 microsoft corporation. all rights reserved. terms of useInternet Link.