Forum Moderators: open
How about something like this? Instead of greying out the second select, just swap out the html based on the choice in the first select:
<!--
//here we set up the array to handle the subselects
var subArray=new Array(4)
//each element of subArray after the first contains an array of select options
subArray[0]=''
subArray[1]=new Array('Pangolin','Anteater','Echidna')
subArray[2]=new Array('Carp','Anchovy','Salmon','Halibut')
subArray[3]=new Array('Alligator','Iguana','Turtle','Rattlesnake','Gila Monster')
//this function builds the subselect object HTML and writes it to div2
function setSub(obj){
var subRow=obj.selectedIndex
//if choice is other than default option
if (subRow>0){
var subSelect='<select id="sel2"><option value="">Choose Animal Subtype</option>'
for (i=0;i<subArray[subRow].length;i++){
subSelect=subSelect+'<option value="'+subArray[subRow][i]+'">'+subArray[subRow][i]+'</option>'
}
subSelect=subSelect+'</select>'
//if choice is default option
}else{
subSelect=''
}
document.getElementById('div2').innerHTML=subSelect
}
//-->
</script>
<style type="text/css">
</style>
</head>
<body>
<div id="div1">
<select id="sel1" onchange="setSub(this)">
<option value="">Choose Animal Type</option>
<option value="Mammal">Mammal</option>
<option value="Fish">Fish</option>
<option value="Reptile">Reptile</option>
</select>
</div>
<div id="div2"></div>
</body>
</html>
Hope this helps,
ajkimoto