I'm far from an expert in Javascript but I have done this before and it's usually pretty simple. Can a trained eye see what I've done wrong here? Nothing happens when I change the 'state' in the form.
Code:
<script language="javascript">
function newState()
{
removeAllOptions(document.artic.school);
addOption(document.artic.school, "", "");
if(document.artic.state.value == 'IL')
{
addOption(document.artic.school, "1005", "College Of Lake County");
addOption(document.artic.school, "1019", "John Wood Community College");
addOption(document.artic.school, "0964", "Kaskaskia College");
addOption(document.artic.school, "R00573", "Keller Graduate School Of Mgmt");
addOption(document.artic.school, "1064", "Loyola University Of Chicago");
addOption(document.artic.school, "1076", "Mckendree College");
addOption(document.artic.school, "0954", "Southwestern Illinois College");
}
if(document.artic.state.value == 'IA')
{
addOption(document.artic.school, "1272", "Des Moines Area Comm C-Ankeny");
addOption(document.artic.school, "1279", "Des Moines Area Comm C-Urban");
addOption(document.artic.school, "1314", "Graceland College");
addOption(document.artic.school, "1309", "Hawkeye Community College");
addOption(document.artic.school, "1269", "Indian Hills Comm Colg-Ottumwa");
addOption(document.artic.school, "1275", "Kirkwood Community College");
addOption(document.artic.school, "1330", "Luther College");
addOption(document.artic.school, "1369", "Western Iowa Tech Comm College");
}
if(document.artic.state.value == 'NE')
{
addOption(document.artic.school, "2444", "Creighton University");
addOption(document.artic.school, "2447", "Metropolitan Comm College - Ne");
addOption(document.artic.school, "2491", "Mid-Plains Community College");
addOption(document.artic.school, "2474", "Nebraska Wesleyan University");
addOption(document.artic.school, "4787", "Southeast Cc - Lincoln Campus");
addOption(document.artic.school, "2468", "Univ Of Nebraska At Kearney");
addOption(document.artic.school, "2482", "Univ Of Nebraska At Lincoln");
addOption(document.artic.school, "2464", "Univ Of Nebraska At Omaha");
}
if(document.artic.state.value == 'OK')
{
addOption(document.artic.school, "3431", "Oklahoma City Comm College");
addOption(document.artic.school, "3424", "Oklahoma State University");
addOption(document.artic.school, "3441", "Tulsa Community College");
addOption(document.artic.school, "3442", "University Of Oklahoma");
}
}
</script>
</head>
<body>
<form name="artic" method="post" action="articprint.asp">
<select name="state" style="width:200px" onchange="newState();" >
<option value=""></option>
<option value="IL">Illinois</option>
<option value="IA">Iowa</option>
<option value="NE">Nebraska</option>
<option value="OK">Oklahoma</option>
</select>
<select name="school" style="width:200px" >
</select>
<input type="submit" value="Go" />
</form>
</body>
</html>