Tab key is a "system button". It means that you cannot reprogram it, the
default system behavior will always override your script (the same way the
F1 key always returns browser help, no matter what action did you attach to
this).
Solution are:
1. Simply place login and password one after another in the form. It will
give you the same effect without any programming.
2. If your form layout ABSOLUTELY requires to put some extra stuff between
these fields, than use TABINDEX property (IE 4.x and higher):
<input name="field1" ... tabindex="1">
<input name="field2" ... tabindex="3">
<input name="field3" ... tabindex="2">
Being on field1, on tab press the focus will jump on field3 first
Ralph Freshour <ra***@primemail.com> wrote in message
news:04********************************@4ax.com...
I'm trying to use JS to move the cursor from my user login text field
to the password text field - I've put the onKeyPress() event in the
user input tag but then I press the Tab key the cursor doesn't move -
can someone please help me with this? Thanks...
function detect_tab_key()
{
var key_code = window.event.keyCode;
if (key_code == 9)
{
document.forms[0].frm_password.focus();
document.forms[0].frm_password.select();
}
}