This lets you have another hidden button after the first one, is that what you wanted.
HTML Code:
<html>
<head>
<title>Hide/Show textarea</title>
<script language="JavaScript">
function showhide(radval,divid)
{
if(radval=="yes")
{
document.getElementById(divid).style.visibility="hidden"
} else {
document.getElementById(divid).style.visibility="visible"
}
}
</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" onclick="showhide(this.value,'divtxtb')">
</label>
</div>
<div id="divtxtb" style="visibility:hidden;">
<label>
<input type="radio" name="radio" id="txtb" value="txtb">
</label>
</div>
</form>
</body>
</html>
As to the problem with setting the value of the first hidden button this is what I mean. in your code you have these 2 lines.
HTML Code:
document.myform.txta.value="Enter your reason here"
- in the function
HTML Code:
<input type="radio" name="radio" id="txta" value="txta" onclick="showhide(this.value,'divtxtb')">
- in the body
In the function you are setting a value and you are setting a different value in the HTML
Bookmarks