dcsimg
Writing Values in a Combo
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Arun_K
Posted On:   Tuesday, June 11, 2002 01:13 AM

Is it possible to write values in a Combo box?? I have a text box. When some body enters a value in the text box, I need to write this value in the Combo box.


Arun.K

Re: Writing Values in a Combo

Posted By:   Firat_Tiryaki  
Posted On:   Wednesday, June 12, 2002 05:47 AM

use Option object like below;




function insertOption()
{
optionValue=document.formName.textBoxName.value;
optionText=document.formName.textBoxName.value;
myOption=new Option();
myOption.text=optionText;
myOption.value=optionValue;
document.formName.comboName.options[document.formName.comboName.length]=myOption;
}


above function inserts a new option at the end of the combo, you can use it onchange of your textbox input.



About | Sitemap | Contact