irt.org Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt

Q774 How do I maintain a tab order if form fields in browsers that do not support tabindex?

You are here: irt.org | FAQ | JavaScript | Form | 2 | Q774 [ previous next ]

If the data has been changed, then when the enter key is pressed the form fields onChange event handler is tripped. You can use this to set the focus on another form field:

<FORM NAME="myForm">
<INPUT TYPE="TEXT" NAME="text1" onChange="this.form.text2.focus()">
<INPUT TYPE="TEXT" NAME="text2" onChange="this.form.text3.focus()">
<INPUT TYPE="TEXT" NAME="text3">
</FORM>

Alternatively, you can use the onBlur event handler to trap something similar:

<FORM NAME="myForm">
<INPUT TYPE="TEXT" NAME="text1" onBlur"this.form.text2.focus()">
<INPUT TYPE="TEXT" NAME="text2" onBlur="this.form.text3.focus()">
<INPUT TYPE="TEXT" NAME="text3">
</FORM>

However, not all of the older browsers/operating systems support the onBlur event handler.

©2013 Martin Webb

ArticlesFAQsGamesFeedback

FOLDOCRFCsInstant JavaScriptSoftwareBooksJavaScript Programmer's ReferenceAboutTop