Setting focus - setActive();

Discussion in 'Javascript' started by jodleren, Feb 16, 2007.

  1. jodleren

    jodleren Guest

    Hi

    I have....

    <body onload="document.forms[0].elements[0].setActive();">

    This sets focus to the element, but when pressing TAB it does not go
    to the next element. It will go to some other point (link before or
    the address in the browser)
    Is there another way?

    BR
    S
     
    jodleren, Feb 16, 2007
    #1
    1. Advertising

  2. jodleren

    ASM Guest

    jodleren a écrit :
    > Hi
    >
    > I have....
    >
    > <body onload="document.forms[0].elements[0].setActive();">
    >
    > This sets focus to the element, but when pressing TAB it does not go
    > to the next element. It will go to some other point (link before or
    > the address in the browser)
    > Is there another way?


    don't know how you fix your setActive();
    I can't reproduce what you say.

    === soluce 1 ===

    <body onload="document.forms[0].elements[1].focus();">

    === soluce 2 ===

    function setActive(what) {
    what.focus();
    // what.select();
    }

    <body onload="setActive(document.forms[0].elements[0]);">

    --
    Stephane Moriaux et son (moins) vieux Mac déjà dépassé
    Stephane Moriaux and his (less) old Mac already out of date
     
    ASM, Feb 16, 2007
    #2
    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,631
    Jason
    May 7, 2007
  2. Replies:
    2
    Views:
    343
    Thomas 'PointedEars' Lahn
    Jun 6, 2005
  3. Roger
    Replies:
    3
    Views:
    336
  4. Jeff

    manual focus vs. focus()

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

Share This Page