Grant Wagner wrote on 02 jan 2004 in comp.lang.javascript
:
<form>
<input type="text" name="one" tabindex="1">
<input type="text" name="two" tabindex="2">
<input type="text" name="three" tabindex="3">
<input type="text" name="four" tabindex="4"
onblur="this.form.elements['one'].focus();"> </form>
Doesn't help if the user hits SHIFT+TAB in the first form element
however.
You can use to "hidden" inputs that only act as tab and shift-tab catch.
They cannot be visibility:hidden or display:none, just style zero-sized.
The tab sequence will be 234523452...
The shift-tab sequence will be 5432543254....
Try:
<script>tabn=false;</script>
<form>
<input style="width:0;height:0;" tabindex="1"
onfocus="if(tabn){tabn=false;this.form.elements['four'].focus();}">
<input type="text" name="one" tabindex="2" onkeydown="tabn=true">
<input type="text" name="two" tabindex="3">
<input type="text" name="three" tabindex="4">
<input type="text" name="four" tabindex="5">
<input style="width:0;height:0;" tabindex="6"
onfocus="this.form.elements['one'].focus();">
</form>
IE6 tested.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)