faqts : Computers : Programming : Languages : JavaScript : Forms : SELECT

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

37 of 47 people (79%) answered Yes
Recently 5 of 10 people (50%) answered Yes

Entry

How can I make selected an option based on its "value" rather than its index position?

Sep 27th, 2001 17:12
Ami Yanero, Egil Merrygold,


This is the code that I'm using for the same functionality:

  for (var i = 1; i < document.formName.selectName.length; i++)
  {
    if(document.formName.selectName.option[i].text == "String")
    {
      What do you want to do with it now that you know it matches?  
    }
  }

Good Luck!
Ami D. Yanero, MCP