I am working on the code below as I have a need to have a certain drop down to appear on select on a value in the drop down before.
The code below is the basic option, but for some reason, its not working, am I missing something as below is every bit of the code related to it, I havent added anything else in relation to it.
Its at the bottom:
http://www.whhazardreport.co.uk/manager_Admin/detail.php?ID=66
<select id = "opts" onchange = "showForm()">
<option value = "0">Select Option</option>
<option value = "1">Option 1</option>
<option value = "2">Option 2</option>
</select>
<div id = "f1" style="display:none">
<select id = "opts" onchange = "showForm()">
<option value = "0">Select Option</option>
<option value = "1">Option 5</option>
<option value = "2">Option 6</option>
</select>
</div>
<div id = "f2" style="display:none">
<select id = "opts" onchange = "showForm()">
<option value = "0">Select Option</option>
<option value = "1">Option 3</option>
<option value = "2">Option 4</option>
</select>
</div>
<script type = "text/javascript">
function showForm(){
var selopt = document.getElementById("opts").value;
if (selopt == 1) {
document.getElementById("f1").style.display="block";
document.getElementById("f2").style.display="none";
}
if (selopt == 2) {
document.getElementById("f2").style.display="block";
document.getElementById("f1").style.display="none";
}
}
</script>