hi,
i have two combo boxes. my first combo box lists the state name and my second combo box list the city names. if i select the state name as “mumbai” the particular cities should add up in the city combo box. i have used addItem() method and onChange() event of “state” combobox. but it is not working.
here is my code:
html:
<form name=”combobox_validation”>
Select state <select name=”selectstate” onChange=”return comboBoxValidation()”>
<option value=”select a state” selected=”true”>select a state</option>
<option value=”tamil nadu”>Tamil Nadu</option>
<option value=”andhra pradesh”>Andhra Pradesh</option>
<option value=”kerala”>Kerala</option>
<option value=”karnataka”>Karnataka</option>
</select>
Select city <select name=”city”>
<option value=”select a city” selected=”true”>select a city</option>
city.addItem(“chennai”);
</select>
</form>
javascript:
function comboBoxValidation()
{
if(document.combobox_validation.selectstate.selectedIndex==1)
{
document.combobox_validation.city.addItem(“chennai”);
document.combobox_validation.city.addItem(“kovai”);
}
}
please help me…