SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Threaded View

  1. #1
    SitePoint Addict jamesbond's Avatar
    Join Date
    Feb 2001
    Location
    The Netherlands
    Posts
    256
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    default value in select list

    I'm trying to figure out how to preselect a country in a form, I have this so far:
    --------------------
    <form name=order>
    <select name=country>
    <option value="aaa">aaa</option>
    <option value="aaa">bbb</option>
    <option value="bbb">ccc</option>
    </select>
    </form>
    <script>
    document.order.country.selectedIndex=1;
    </script>
    ---------------------

    But I would like to be able to preselect a country based on the option value.
    Something like (this doesn't work obviously):

    document.order.country.selected.option='bbb';


    The default value for the country will be supplied by a previous form, so it changes depending on what has been selected in the previous form.
    Last edited by jamesbond; Mar 4, 2002 at 07:59.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •