我想uncheck
一个radiobutton
我找到了一种方法做这一点,但同时单选按钮的表单中的代码将无法正常工作,这是我的unchecking
脚本检查单选按钮如何取消单选按钮
<script type="text/javascript">
var allRadios = document.getElementsByName(1);
var booRadio;
var x = 0;
for(x = 0; x < allRadios.length; x++){
allRadios[x].onclick = function() {
if(booRadio == this){
this.checked = false;
booRadio = null;
}else{
booRadio = this;
}
}
}
</script>
<form name="theForm" target="_blank" action="laravel.php">
<label for="test">test</label>
<input type="radio" id="1" class="radio" name="1" value="1">
<input type="radio" id="2" class="radio" name="1" value="2">
<input type="radio" id="3" class="radio" name="1" value="3">
<input type="radio" id="4" class="radio" name="1" value="4">
</form>
脚本工作正常时,单选按钮形式的标签之外,但在无线电输入的形式为我想知道我是什么在这里失踪
似乎做工精细,http://jsfiddle.net/rL1g9qa4/也许你的输入(这应该是自闭)''导致问题 – andrew 2014-10-01 22:48:52