|
Posted by Steve Pugh on 02/27/06 21:33
"Travis Newbury" <TravisNewbury@hotmail.com> wrote:
>Aaron wrote:
>> I need to set focus to a input text field on a simple form at onLoad.
Do you really need to? What would happen if you couldn't?
If you have a very small page, on a fast server, with just one single
form input (i.e. if you're the Google home page) then you can get
away with this. Otherwise you have to consider that on a slow loading
page the user may start typing in a form field and then when the page
finishes loading, your script would place the focus back at the start
of your chosen field. This would lead to the user's typing being
screwed up.
If you are the Google home page then look at your own source code. ;-)
>The form is not loaded yet.
Both the HTML spec
<http://www.w3.org/TR/html401/interact/scripts.html#adef-onload> and
observed behaviour in several browsers disagrees with you.
"The onload event occurs when the user agent FINISHES loading a
window" (my emphasis)
Steve
--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor
Steve Pugh <steve@pugh.net> <http://steve.pugh.net/>
Navigation:
[Reply to this message]
|