Add option method to form.select object 
Author Message
 Add option method to form.select object

I want to programmatically add select options:

document.form.select.option[document.form.select.length+1] = new option(par1,par2)

A sample code line would be great...
--
Steve Fowler
Sr. Systems Developer, CTO
Fowler Consulting

-"When you need a solution, not a warm body"



Sun, 13 Jan 2002 03:00:00 GMT  
 Add option method to form.select object

Here is a solution:
__________________________________________________
function AddItem(pAddThis) {
    var opt = new Option (pAddThis, pAddThis, false, false);
    var s = document.Form1.Select1;
    s.options[s.options.length] = opt;

Quote:
}

__________________________________________________
Steve Fowler
Sr. Systems Developer, CTO
Fowler Consulting

-"When you need a solution, not a warm body"


Sun, 13 Jan 2002 03:00:00 GMT  
 Add option method to form.select object


Quote:
>I want to programmatically add select options:

Hi Steve,

One way to do this (not using 'new Option()', which can cause problems) can
be found here:

http://www.netspace.net.au/~torrboy/code/jscriptfaq/hosts/browsers/an...
tml#a004

Hope this helps you,

Peter

--

Microsoft Windows Script Program Manager.
http://msdn.microsoft.com/scripting



Sun, 13 Jan 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Add fields to a form by selecting the option to do so

2. remove method for options not removing selected option.

3. changing select options based on previously selected options

4. add option to select list

5. Netscape 6 - adding an option to select

6. Adding options to a select element

7. Prob when adding new OPTION to SELECT

8. Add Option string to select control?

9. add new option item to the select from another frame

10. how to add OPTION element in SELECT at runtime using Client side vbscripting

11. Prob when adding new OPTION to SELECT

12. Dynamically adding OPTION to SELECT

 

 
Powered by phpBB® Forum Software