Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > focus()

Reply
Thread Tools

focus()

 
 
James Lattanzio
Guest
Posts: n/a
 
      04-03-2004
Dear Anyone,

I have a form with many elements. I want the Submit button to have the
focus when the page is loaded, even though it is not first in the list of
elements to display. How can I do this?

Thank you.

James Lattanzio


 
Reply With Quote
 
 
 
 
Jukka K. Korpela
Guest
Posts: n/a
 
      04-03-2004
"James Lattanzio" <(E-Mail Removed)> wrote:

> I have a form with many elements. I want the Submit button to
> have the
> focus when the page is loaded, even though it is not first in the
> list of elements to display. How can I do this?


<input type="submit" id="subm">
<script type="text/javascript">
document.getElementById('subm').focus();
</script>

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html


 
Reply With Quote
 
 
 
 
brucie
Guest
Posts: n/a
 
      04-03-2004
in post: <news:406ecf98$0$3052$(E-Mail Removed)>
"James Lattanzio" <(E-Mail Removed)> said:

> I have a form with many elements. I want the Submit button to have the
> focus when the page is loaded, even though it is not first in the list of
> elements to display.


not a good idea. its really annoying when you're typing away and
suddenly the focus changes to another area.

don't expect your visitors to wait for the page to finish downloading
then for the cursor to move to where you want it before they start
filling out a form or for them to fill out the from in a top down
manner.

--
b r u c i e
 
Reply With Quote
 
mscir
Guest
Posts: n/a
 
      04-03-2004
brucie wrote:

> "James Lattanzio" <(E-Mail Removed)> said:
>
>>I have a form with many elements. I want the Submit button to have the
>>focus when the page is loaded, even though it is not first in the list of
>>elements to display.

>
>
> not a good idea. its really annoying when you're typing away and
> suddenly the focus changes to another area.
>
> don't expect your visitors to wait for the page to finish downloading
> then for the cursor to move to where you want it before they start
> filling out a form or for them to fill out the from in a top down
> manner.


I agree, this happens to me on hotmail, it's really annoying.

 
Reply With Quote
 
Jukka K. Korpela
Guest
Posts: n/a
 
      04-03-2004
brucie <****@bruciesusenetshit.info> wrote:

>> I have a form with many elements. I want the Submit button to
>> have the
>> focus when the page is loaded, even though it is not first in the
>> list of elements to display.

>
> not a good idea. its really annoying when you're typing away and
> suddenly the focus changes to another area.


While I generally agree with that principle, focusing on a submit button
_might_ be an exception. Consider a set of small pages, containing some
material divided into nice pieces, each with a link to the next piece.
And someone might use <form action="foo43.html"><input type="submit"
value="Next"></form> instead of a link. It might be convenient to the
user to just hit Enter to see the next piece. Of course it would be
better to replace the button with the real thing, a link, but even for a
real link, focusing on it could be nice _in rare special cases_.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments