This is the code sample! Click here to Close Window and Return to Article
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
<SCRIPT LANGUAGE=javascript>
<!--
arrModels = new Array(3)
arrModels [0] = new Array(1)
arrModels [1]= new Array(3)
arrModels [2] = new Array(4)
//Empty (0)
arrModels [0][0.0] = " "
arrModels [0][0.1] = " "
//Ford (3)
arrModels [1] [0.0] = "economy:tempo"
arrModels [1] [0.1] = "Tempo"
arrModels [1] [1.0] = "luxury:taurus"
arrModels [1] [1.1] = "Tauras"
arrModels [1] [2.0] = "minivan:windstar"
arrModels [1] [2.1] = "Windstar"
//Toyota (2)
arrModels [2][0.0] = "economy:tercel"
arrModels [2][0.1] = "Tercel"
arrModels [2][1.0] = "midprice:corolla"
arrModels [2][1.1] = "Corolla"
arrModels [2][2.0] = "luxury:camary"
arrModels [2][2.1] = "Camry"
arrModels [2][3.0] = "moneytoburn:avalon"
arrModels [2][3.1] = "Avalon"
//============================================
//Next, we create a function to fill the second drop down from
//the array based on the item selected in the first drop down.
function FillList(){
    var objSelectModels = document.forms['frmMultipleSelects'].elements['strModels'];
    var intArrayIndex= document.forms['frmMultipleSelects'].elements['strManufacturer'].selectedIndex;
    objSelectModels.selectedIndex = 0;
    objSelectModels.length =0;
    for (i=0;i<arrModels[intArrayIndex].length;i++){
     objSelectModels.options[i] = new Option()
         objSelectModels.options[i].value = arrModels[intArrayIndex][eval(i + ".0")]
         objSelectModels.options[i].text = arrModels[intArrayIndex][eval(i + ".1")]
     }
     objSelectModels.focus() ;
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<form action="http://www.fairfieldconsulting.com/processForm.asp" method="post" name="frmMultipleSelects" id="frmMultipleSelects">
    <select name="strManufacturer" onChange="javascript:FillList()">
        <option value="" SELECTED></option>
        <option value="Ford">Ford</option>
        <option value="Toyota">Toyota</option>
    </select>
    <br />
    <select name="strModels">
        <option value="" SELECTED></option>
    </select>
    <br />
    <input type="submit" name="btnSubmit" value="Submit">
</form>
</BODY>
</HTML>