![]() |
|
|
+ Search |
![]()
|
Nov 27th, 2007 08:03
Ronald Avendaņo, Marcelo Coelho, baladitya ganty, Sue Crocker,
The easy way by Ronald Avendaņo ( ronald.avendano@gmail.com ):
It works on Firefox & IE.
<script language="JavaScript">
<!--
function unCheckRadio(oRadio) {
var or = document.getElementsByName(oRadio);
for (var i = 0; i < or.length; i++) {
or[i].checked = false;
}
}
//-->
</script>
How to call it with a name of the radio
<a href="javascript:unCheckRadio('radio1');">Uncheck Radio radio1</a>
Another way by other Author
See this sample (works in IE3+ and NE3+):
<form name=form1 action="yourscript.asp" method=post>
<input type=radio name=radio1 value="Big" selected>Big
<input type=radio name=radio1 value="Small">Small
<br>
<input type=submit value="Post Form">
<input type=button value="Clear All Radio Buttons"
onClick="clear_radio_buttons();">
</form>
<script language="JavaScript">
<!--
function clear_radio_buttons() {
for (var i = 0; i < document.form1.radio1.length; i++) {
document.form1.radio1[i].checked = false;
}
}
//-->
</script>
This sample should work with checkboxes too.
© 1999-2004 Synop Pty Ltd