RE: Need Help Please

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[snip]
Although someone else has suggested you use JavaScript to set the 
focus on a particular form field, I urge you instead to use HTML 
tabindex property:

<p>User Name: <input tabindex="1" type="text" name="username"> </p> <br>
<p>Password: <input tabindex="2" type="password" name="password"> </p>
<br>
<p><input tabindex="3" type="submit" value="Login"> </p>

HTML 4.01 Specification
17 Forms
17.11 Giving focus to an element
17.11.1 Tabbing navigation
http://www.w3.org/TR/html4/interact/forms.html#h-17.11.1

Simplistic JavaScript solutions place focus on an input field after 
the page has completely loaded, often after the user has begun 
interacting with the form, causing irritating focus jumps in mid-input.
[/snip]

While tabindex is a neat thing to use it does not necessarily give focus
to the first element of the form, it merely dictates the order in which
form elements will be given focus when the tab key is pressed. The
action may vary from browser to browser. Likely, when going to a form
with tabindex defined, none of the elements will have focus until the
tab key is pressed once, at which time the element with tabindex="1"
will get focus.

If you want to give focus to the first input element of a form you must
still use a JavaScript widget to place the focus there after the entire
page has loaded, tabindex will make sure that the cursor goes in the
order you wish to go in after that.

YMMV

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux