单选按钮取消选中状态

方法一:

<form>
<input type="radio" name='radio' value="1" onclick='check(this)'>单选一
<input type="radio" name='radio' value="2" onclick='check(this)'>单选二
<input type="radio" name='radio2' value="1" onclick='check(this)'>单选1
<input type="radio" name='radio2' value="2" onclick='check(this)'>单选2
</form>
<script>
var tempradio= null;
function check(checkedRadio)
{
if(tempradio== checkedRadio){
tempradio.checked=false;
tempradio=null;
}
else{
tempradio= checkedRadio;
}
}
</script>


方法二: