[thelist] Adding items to combo boxes

Dominik Wee dominik at alamy.com
Fri Jul 20 10:15:08 CDT 2001


Hi

Can anybody help with the following problem: I want to add an option to
the beginning of an existing HTML combo box (select)using JavaScript. I
know that I can add elements to the _end_ of the list by:

   newOptionJobTitle = new Option("select one...", "default");
 
document.frmSearchBar.JobTitleID.options[document.frmSearchBar.JobTitleI
D.options.length] = newOptionJobTitle;

but how do I insert options at the _top_ without overwriting the first
item? 

Many thanks in advance,

Dominik

Web Developer
http://www.alamy.com
dominik at alamy.com	




More information about the thelist mailing list