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?

123 of 140 people (88%) answered Yes
Recently 9 of 10 people (90%) answered Yes

Entry

Can I dynamically select all options from a select multiple list (I want to pass their values onto another page)?

Mar 6th, 2001 15:05
B Kez, Tony Amaral,


This function takes the form name and the select box name as 
parameters, and sets the "selected" attribute of every option to "true".

function selectAll(FormName, SelectBox){
  temp = "document." + FormName + "." + SelectBox;
  Source = eval(temp);

  for(x=0; x<(Source.length); x++){
    Source.options[x].selected = "true";
    }
}