Hi, this is the first time that I write in this forum.
I have a problem…I will build a dynamic form Select whit three fields,where the second field depends on the first one and the third field it depends on the second..I have the code javascript for one dynamic select whit two fields but I need another field.
This is the code that I have…is possible to obtain my aim modifying this code or not?
[B]HTML CODE:
<form name=”jump”>
<p>
<select name=”region” onChange=”fillCountry()”>
<option value=”1″>Catanzaro
<option value=”2″>Cosenza
<option value=”3″>Crotone
<option value=”2″>Reggio Calabria
<option value=”3″>Vibo Valentia
</select>
<select name=”country”>
<option>————————
<option>————————
<option>————————
<option>————————
<option>————————
<option>————————
</select>
</p>
</form>
[B]SCRIPT CODE:
<script language=”JavaScript1.2″>
var RegionsDashes = “”
var CountriesDashes = “”
var DefaultLink = “/dest/index.htm”
Countries = new Object()
Links = new Object()
Regions = new Array(“Italy”,”USA”)
Countries[“Italy”] = new Array(“Calabria”,”Campania”);
Links[“Italy”] = new Array(“Calabria”,”Campania”);
Countries[“USA”] = new Array(“Connecticut”,”California”);
Links[“USA”] = new Array(“Connecticut”,”California”);
fillCountry()
function fillCountry(){
document.jump.country.length = 0;
reg = new String(Regions[document.jump.region.selectedIndex])
if (reg == RegionsDashes) {
document.jump.region.selectedIndex = document.jump.region.selectedIndex – 1
reg = new String(Regions[document.jump.region.selectedIndex])
}
document.jump.country.options[0] = new Option(Countries[reg][0],Links[reg][0],1,1);
for(count = 1; count < Links[reg].length; count ++)
document.jump.country.options[count] = new Option(Countries[reg][count],Links[reg][count]);
}
</script>
Thank you…………… ? ?