Focus on Select

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Nicolas Mainczyk

    Focus on Select

    Hi,

    Is there a way to focus on a drop down list of a form.

    I tried element.focus() select() click() in vain....

    TIA
    Regards,
    Nicky.


  • Chris Riesbeck

    #2
    Re: Focus on Select

    "Nicolas Mainczyk" <nmainczyk@hotm ail.com> wrote in message news:<brn8qd$c3 $1@ngspool-d02.news.aol.co m>...[color=blue]
    > Hi,
    >
    > Is there a way to focus on a drop down list of a form.
    >
    > I tried element.focus() select() click() in vain....[/color]

    Where did you call focus()? The following worked fine for me:

    ....
    function init() {
    document.forms[0]["items"].focus();
    }
    ....
    <body onload="init()" >
    ....
    <select name="items">

    Comment

    • Thomas 'PointedEars' Lahn

      #3
      Re: Focus on Select

      Chris Riesbeck wrote:
      [color=blue]
      > "Nicolas Mainczyk" <nmainczyk@hotm ail.com> wrote in message news:<brn8qd$c3 $1@ngspool-d02.news.aol.co m>...[/color]

      Your attribution line exceeds the recommended maximum of 78 characters
      per line. This is not necessary since it contains a lot of superfluid
      information that can be retrieved through message headers by those who
      are really interested in it.
      [color=blue][color=green]
      >> I tried element.focus() select() click() in vain....[/color]
      >
      > Where did you call focus()? The following worked fine for me:
      >
      > ....
      > function init() {
      > document.forms[0]["items"].focus();[/color]

      The sane way is

      document.forms[0].elements["items"].focus();
      [color=blue]
      > }[/color]


      Merry Christmas! (if you celebrate it)

      PointedEars

      Comment

      Working...