<html>
<head>
<title>Cascaded Combos Population</title>
<script language="javascript">
var States = new Array("Khorasan", "Isfahan", "Yazd" , "Fars") ;
var Khorasan = new Array("Mashhad", "Tabas", "Birjand") ;
var Isfahan = new Array("Isfahan", "Naeen", "Najafabad") ;
var Yazd = new Array("Yazd", "Meybod") ;
var Fars = new Array("Shiraz", "Darab") ;
function Init() {
Fill_Combo("State", States) ;
}
function Fill_Combo(Combo,List) {
for (i=0 ; i<List.length ; i++) {
var OPTN = document.createElement("OPTION");
eval("document.Form_1." + Combo + ".options.add(OPTN)") ;
OPTN.innerHTML = List[i];
}
}
function Update_Cities(n) {
document.Form_1.City.innerHTML = "" ;
if (n>0) eval("Fill_Combo('City'," + States[n - 1] +")") ;
}
</script>
</head>
<body onload="Init()">
<form name="Form_1">
<select name="State" onchange="Update_Cities(this.selectedIndex)">
<option value="0" selected>--SELECT--</option>
</select>
<select name="City"></select>
</form>
</body>
</html>