Selecting Item in Drop Down List Box

Discussion in 'HTML' started by Andrew, Apr 15, 2005.

  1. Andrew

    Andrew Guest

    I have a Drop Down List box of all of the days in the month (1-31). I
    would like to set a specific item as selected when the user drops down
    the box. For example, if the current value is 19, when the user drops
    the box down, I would like the highlight to be on the 19 in the list,
    how do I do this?

    Thanks.

    Jeff
     
    Andrew, Apr 15, 2005
    #1
    1. Advertising

  2. Andrew

    Steve Pugh Guest

    Andrew <> wrote:

    >I have a Drop Down List box of all of the days in the month (1-31). I
    >would like to set a specific item as selected when the user drops down
    >the box. For example, if the current value is 19, when the user drops
    >the box down, I would like the highlight to be on the 19 in the list,
    >how do I do this?


    With the selected attribute
    http://www.w3.org/TR/html401/interact/forms.html#adef-selected

    Steve

    --
    "My theories appal you, my heresies outrage you,
    I never answer letters and you don't like my tie." - The Doctor

    Steve Pugh <> <http://steve.pugh.net/>
     
    Steve Pugh, Apr 15, 2005
    #2
    1. Advertising

  3. Andrew <> wrote:

    > I have a Drop Down List box of all of the days in the month (1-31).


    Replace it by a text input field. Which one is faster, typing "30" or
    scrolling down a menu and trying to choose "30" there? Not to mention
    the possibility of being forced to _listen_ to "select one of the
    following: one, two, three, four, five, ..." until you hear "thirtyone"
    and realize that you just skipped "thirty" and don't know what to do.

    > I would like to set a specific item as selected when the user
    > drops down the box.


    <input type="text" id="month" name="month" size="2" maxlength="2"
    value="19">

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
     
    Jukka K. Korpela, Apr 15, 2005
    #3
    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. Bogdan Zamfir

    Selecting an item in a drop down list

    Bogdan Zamfir, Aug 17, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    438
    Bogdan Zamfir
    Aug 17, 2003
  2. Natty Gur
    Replies:
    1
    Views:
    326
    Bogdan Zamfir
    Aug 18, 2003
  3. SirPoonga
    Replies:
    2
    Views:
    815
    Ben Strackany
    Jan 7, 2005
  4. KatMagic

    Selecting an item in a drop down list

    KatMagic, Apr 10, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    10,463
    KatMagic
    Apr 11, 2006
  5. weiwei
    Replies:
    0
    Views:
    1,069
    weiwei
    Jan 5, 2007
Loading...

Share This Page