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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

change (add option ) two form.select onclick

Status
Not open for further replies.

fuadhamidov

Programmer
Sep 22, 2003
98
TR
Hi
i am new in js. i have tried and found some code to add an option to 'select' field. then i 'developed' it to add two option to two different select tag but i failed. the code i used is that
var option = document.form.TETS.value;
document.form.SIZE.options[document.form.SIZE.options.length] = new Option( option );
document.form.SIZE.options[document.form.SIZE.options.length - 1].value=document.form.NUMBER.value; document.form.SIZE.options[document.form.SIZE.options.length - 1].selected = true;
// *********** part2
document.form.SIZE2.options[document.form.SIZE2.options.length] = new Option( option );
document.form.SIZE2.options[document.form.SIZE2.options.length - 1].value=document.form.NUMBER.value; document.form.SIZE2.options[document.form.SIZE2.options.length - 1].selected = true;

the code work until 'part2' but second option does not occur
 
are u sure part2 is the problem? try giving alert statements...

Known is handfull, Unknown is worldfull
 
thanks
i can't find my mistake. because i cant do it i have cleared 'part2' but when i write again it works
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top