Closed Thread Icon

Preserved Topic: Hide/Show a radio button Pages that link to <a href="https://ozoneasylum.com/backlink?for=18551" title="Pages that link to Preserved Topic: Hide/Show a radio button" rel="nofollow" >Preserved Topic: Hide/Show a radio button\

 
Author Thread
kw7669
Nervous Wreck (II) Inmate

From: Columbus, Ohio, USA
Insane since: Nov 2002

posted posted 11-21-2002 20:24

I was wondering if it is possible to hide and show a radio button. I already hide and show textboxes, but I am unable to hide/show radio buttons.

function hide()
{
form1.text1.style.visibility = "hidden" ;
form1.text2.style.visibility = "hidden" ;
}
function show()
{
form1.text1.style.visibility = "" ;
form1.text2.style.visibility = "" ;
}

This is what I have so far, but like I said, I don't know how to hide the radio buttons.

Any help is appreciated.

Thank you and have a great day.

Ken

andy_j
Nervous Wreck (II) Inmate

From: uk
Insane since: Aug 2002

posted posted 11-26-2002 04:05

You can do it the same way

<html>
<head>
<script type="text/javascript">
function hide(el) {
document.getElementById(el).style.visibility="hidden";
}
function show(el) {
document.getElementById(el).style.visibility="visible";
}
</script>
</head>

<body>
<form>
<input type="text" size="20" value="Text Box 1" id="textOne"><a href="javascript: hide('textOne')">Hide</a> - <a href="javascript: show('textOne')">Show</a><br />
<input type="text" size="20" value="Text Box 2" id="textTwo"><a href="javascript: hide('textTwo')">Hide</a> - <a href="javascript: show('textTwo')">Show</a><br />
<input type="radio" name="rad" id="radioOne">
<input type="radio" name="rad" id="radioTwo"><br>
<a href="javascript: hide('radioOne')">Hide Radio button One</a> - <a href="javascript: show('radioOne')">Show Radio button One</a><br />
<a href="javascript: hide('radioTwo')">Hide Radio button Two</a> - <a href="javascript: show('radioTwo')">Show Radio button Two</a>
</form>

</body>
</html>

example

Yossi Admon
Bipolar (III) Inmate

From: Israel
Insane since: Nov 2001

posted posted 11-26-2002 08:19

I prefer to use the .style.display = "block" / "none" to hide and show objects because it removes the object display size from the page and not just hide it.

« BackwardsOnwards »

Show Forum Drop Down Menu