Controlling the tab Index Property

JavaScript Bible, Fourth Edition
by Danny Goodman

John Wiley & Sons CopyRight 2001

<TITLE>tabIndex Property</TITLE>
function invert() {
var form = document.lab
for (var i = 0, j = form.elements.length; i < form.elements.length;
i++, j--) {
form.elements[i].tabIndex = j
function skip2() {
document.lab.text2.tabIndex = -1
function resetTab() {
var form = document.lab
for (var i = 0; i < form.elements.length; i++) {
form.elements[i].tabIndex = 0
<H1>tabIndex Property Lab</H1>
<FORM NAME="lab">
Text box no. 1: <INPUT TYPE="text" NAME="text1"><BR>
Text box no. 2: <INPUT TYPE="text" NAME="text2"><BR>
<INPUT TYPE="button" VALUE="A Button"><BR>
<INPUT TYPE="checkbox">And a checkbox
<FORM NAME="control">
<INPUT TYPE="button" VALUE="Invert Tabbing Order" TABINDEX=-1 onClick="invert()"><BR>
<INPUT TYPE="button" VALUE="Skip Text box no. 2 (IE Only)" TABINDEX=-1
<INPUT TYPE="button" VALUE="Reset to Normal Order" TABINDEX=-1 onClick="resetTab()">

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: