Liam
08-14-2009, 07:51 AM
Hello every one.
Im a bit stuck with some code. The code below lets the user click on a radio button if they click on No then another radio button appears. I want to know if there is a way of adding extra code so if you click on the radio button that appears when you click no more radio buttons appear.
I have tried a number of things but nothing is working the way I want it.
Any help would be great.
Thanks
<html>
<head>
<title>Hide/Show textarea</title>
<script language="JavaScript">
function showhide(radval,divid)
{
if(radval=="no")
{document.getElementById(divid).style.visibility="visible"}
if(radval=="yes")
{
document.getElementById(divid).style.visibility="hidden"
document.myform.txta.value="Enter your reason here"
}
}
</script>
</head>
<body>
<form name="myform">
<input type="radio" name="rad" value="yes" onclick="showhide(this.value,'divtxta')">Yes<br>
<input type="radio" name="rad" value="no" onclick="showhide(this.value,'divtxta')">No
<div id="divtxta" style="visibility:hidden;">
<label>
<input type="radio" name="radio" id="txta" value="txta">
</label>
</div>
</form>
</body>
</html>
Im a bit stuck with some code. The code below lets the user click on a radio button if they click on No then another radio button appears. I want to know if there is a way of adding extra code so if you click on the radio button that appears when you click no more radio buttons appear.
I have tried a number of things but nothing is working the way I want it.
Any help would be great.
Thanks
<html>
<head>
<title>Hide/Show textarea</title>
<script language="JavaScript">
function showhide(radval,divid)
{
if(radval=="no")
{document.getElementById(divid).style.visibility="visible"}
if(radval=="yes")
{
document.getElementById(divid).style.visibility="hidden"
document.myform.txta.value="Enter your reason here"
}
}
</script>
</head>
<body>
<form name="myform">
<input type="radio" name="rad" value="yes" onclick="showhide(this.value,'divtxta')">Yes<br>
<input type="radio" name="rad" value="no" onclick="showhide(this.value,'divtxta')">No
<div id="divtxta" style="visibility:hidden;">
<label>
<input type="radio" name="radio" id="txta" value="txta">
</label>
</div>
</form>
</body>
</html>