Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

create a combo box??

Status
Not open for further replies.

pichi

Programmer
Nov 12, 2000
156
EC
hi everybody,, how can i create a combo box!!
for example,, i have the combobox object created, but in the onload event of the form i want to asign it the values.
I can put one value in the combo, but i don't know how to put more than one?? can anybody help me?? please
any advice would be appreciated.

example:

document.forms[0].Cat.options[0].text="First";
i can't get the second one in the combo box!!!
document.forms[0].Cat.options[1].text="Second"; ????



Juan Pablo
 
Put the text that you want the user to see where text is below and the value is what the value of that option is:

document.forms[0].add(new Option(text,value)) jared@aauser.com
 
Hi jaredn, thanks for your answer, but
i am a little confused,
when you say that i have to use that command
document.forms[0].add(new Option(text,value))

where the text is for example "First" ,i am correct??
but my confusion is with the value, what value is that??
and where i specify the field name (in this case the combo
box name ).

sorry for bothering you!! thanks again!!

Pichi

 
oops:
document.forms[0].selectboxname.add(new Option("JN",0))

that will make the words JN available to the user to pick from the box, but if you test the value, it will be 0 - lets say because JN is employee 0 - you can make them the same:
new Option("jn","jn") jared@aauser.com
 
Thanks both of you!! that really work, but i have another problem, this only work with IE, but i also use Netscape 4.7, do you know how to do it in Netscape??
thanks!!

Pichi
 
i would suggest that you upgrade to ns 6 that supports the official dom ...
no, seriously, the only way i know to do this in ns, is to create all the combos you need and then hide and show :-(
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top