M
Mel Smith
Hi:
(JavaScript newbie warning)
I would like to emulate the operation of the <tab> key (with JS code)
when moving from one input text field to another. I am testing using IE7,
FireFox and Chrome.
Assume that the set of input text fields are as follows (and are filled
to the maximum length):
*****************************************
<input type="text" id="input1" maxlength="6" size="7" value="input1" />
<br />
<input type="text" id="input2" maxlength="6" size="7" value="input2" />
<br />
<input type="text" id="input3" maxlength="6" size="7" value="input3" />
*****************************************
During my testing I note that the <tab> key operates as follows:
1. The 'focus' moves to the next field.
2. The color and background of the newly focused input field change
to some 'default' (which I can't exactly I can't exactly determine).
3. The input cursor settles (with IE) *before* the first character,
and with fireFox *after* the last character.
4. When the user inputs a character into the already-filled field,
the field immediately clears to empty, and the user can input what he
wishes.
I *like* this operation and would like to emulate it in JavaScript !
However, in JS, when I use the onload="...." clause to set focus on an
input field (or even 'click' on an input field), I do not get the same
operation as tabbing to the field. Instead, I get:
1. The input cursor is placed at the start of input (with IE), and at
the end of the input text with FF), and wherever I place it when 'clicking'
it
2. If the user inputs a character into this 'full' field, it is
rejected -- i.e., nothing is entered, and nothing happens.
So, how can I emulate the operation of the <tab> key with JS please.
Thank you !
-Mel Smith
(JavaScript newbie warning)
I would like to emulate the operation of the <tab> key (with JS code)
when moving from one input text field to another. I am testing using IE7,
FireFox and Chrome.
Assume that the set of input text fields are as follows (and are filled
to the maximum length):
*****************************************
<input type="text" id="input1" maxlength="6" size="7" value="input1" />
<br />
<input type="text" id="input2" maxlength="6" size="7" value="input2" />
<br />
<input type="text" id="input3" maxlength="6" size="7" value="input3" />
*****************************************
During my testing I note that the <tab> key operates as follows:
1. The 'focus' moves to the next field.
2. The color and background of the newly focused input field change
to some 'default' (which I can't exactly I can't exactly determine).
3. The input cursor settles (with IE) *before* the first character,
and with fireFox *after* the last character.
4. When the user inputs a character into the already-filled field,
the field immediately clears to empty, and the user can input what he
wishes.
I *like* this operation and would like to emulate it in JavaScript !
However, in JS, when I use the onload="...." clause to set focus on an
input field (or even 'click' on an input field), I do not get the same
operation as tabbing to the field. Instead, I get:
1. The input cursor is placed at the start of input (with IE), and at
the end of the input text with FF), and wherever I place it when 'clicking'
it
2. If the user inputs a character into this 'full' field, it is
rejected -- i.e., nothing is entered, and nothing happens.
So, how can I emulate the operation of the <tab> key with JS please.
Thank you !
-Mel Smith