focus()

Discussion in 'HTML' started by James Lattanzio, Apr 3, 2004.

  1. 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
    James Lattanzio, Apr 3, 2004
    #1
    1. Advertising

  2. "James Lattanzio" <> 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
    Jukka K. Korpela, Apr 3, 2004
    #2
    1. Advertising

  3. James Lattanzio

    brucie Guest

    in post: <news:406ecf98$0$3052$>
    "James Lattanzio" <> 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
    brucie, Apr 3, 2004
    #3
  4. James Lattanzio

    mscir Guest

    brucie wrote:

    > "James Lattanzio" <> 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.
    mscir, Apr 3, 2004
    #4
  5. brucie <> 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
    Jukka K. Korpela, Apr 3, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jason
    Replies:
    4
    Views:
    1,618
    Jason
    May 7, 2007
  2. Replies:
    2
    Views:
    336
    Thomas 'PointedEars' Lahn
    Jun 6, 2005
  3. Roger
    Replies:
    3
    Views:
    322
  4. Jeff

    manual focus vs. focus()

    Jeff, May 20, 2007, in forum: Javascript
    Replies:
    4
    Views:
    178
  5. Spizzat2
    Replies:
    2
    Views:
    177
    Spizzat2
    Jan 9, 2008
Loading...

Share This Page