I am new to JavaScript and realize that I'm probably just missing something simple. I have two radio buttons and I want a a certain div tag to display based on which button is selected. I've cut out the extra coding and made a very basic example of what I'm trying to do. If you could be of any help I would greatly appreciate it.
The error that I'm getting is stating that "document.form.techspecsub" is either null or not an object.
Code:
<script type="text/javascript">
function showhide_areabldgreq()
{
if (document.form.techspecsub[0].checked)
{
document.getElementById("areabldg").style.display = "inline";
}
else
{
document.getElementById("areabldg").style.display = "none";
}
if (document.form.techspecsub[1].checked)
{
document.getElementById("reqpo").style.display = "inline";
}
else
{
document.getElementById("reqpo").style.display = "none";
}
}
</script>
<form>
<input name="techspecsub" value="Enter Area" type="radio"
onClick="showhide_areabldgreq()" />Enter Area<br>
<input name="techspecsub" value="Enter Requisition" type="radio"
onClick="showhide_areabldgreq()" />Enter Requisition
</form>
<div id="areabldg" style="display:none">I'm Area</div><br>
<div id="reqpo" style="display:none">I'm Req PO</div>