单选按钮取消选中状态


方法一:

<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>


方法二:


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM