As always, there are many ways to kill a cat!
Code:
<html>
<head>
<script type = "text/javascript">
function setOptions(chosen) {
var selbox = document.myform.opttwo;
selbox.options.length = 0;
if (chosen == "0") {
selbox.options[selbox.options.length] = new Option('Please select one of the options above first',' ');
}
if (chosen == "1") {
selbox.options[selbox.options.length] = new Option('Furniture','Furniture');
selbox.options[selbox.options.length] = new Option('Ceramics','Ceramics');
selbox.options[selbox.options.length] = new Option('Glass','Glass');
}
if (chosen == "2") {
selbox.options[selbox.options.length] = new Option('Drawings and Paintings','Drawings and Paintings');
selbox.options[selbox.options.length] = new Option('Photographs','Photographs');
}
}
</script>
</head>
<body>
<form name="myform">
<select name="optone"
onchange="setOptions(document.myform.optone.options[document.myform.optone.selectedIndex].value);">
<option value="0" selected="selected"> Please select </option>
<option value="1"> Antiques </option>
<option value="2"> Arts and Crafts </option>
</select>
<br> <br>
<select name="opttwo">
<option value=" " selected="selected">Select a main category first</option>
</select>
<br><br>
<input type="button" name="go" value="Click To Alert Value Selected" onclick="alert(document.myform.opttwo.options[document.myform.opttwo.selectedIndex].value);">
</form>
</body>
</html>