28,401
社区成员
发帖
与我相关
我的任务
分享
<label>选中
<input type="checkbox" onchange="this.nextElementSibling.value = (this.nextElementSibling.value==1)?0:1 " />
<input type="hidden" name="aaa[]" value="0" />
</label>
<form >
<input name="b" type="checkbox" id="b1" value="1" onclick="a1.value=this.checked?1:0">
<input name="b" type="checkbox" id="b2" value="1" onclick="a2.value=this.checked?1:0">
<input name="b" type="checkbox" id="b3" value="1" onclick="a3.value=this.checked?1:0">
<input name="b" type="checkbox" id="b4" value="1" onclick="a4.value=this.checked?1:0">
<input name="b" type="checkbox" id="b5" value="1" onclick="a5.value=this.checked?1:0">
<input name="b" type="checkbox" id="b6" value="1" onclick="a6.value=this.checked?1:0">
<input name="a" type="hidden" id="a1" value="0" >
<input name="a" type="hidden" id="a2" value="0" >
<input name="a" type="hidden" id="a3" value="0" >
<input name="a" type="hidden" id="a4" value="0" >
<input name="a" type="hidden" id="a5" value="0" >
<input name="a" type="hidden" id="a6" value="0" >
</form>
<script>
function setA(f) {
var a = '';
for (var i = 0; i < f.a1.length; i++) a += ',' + (f.a1[0].checked ? '1' : '0');
f.a.value = a.substring(1) ;
}
</script>
<form onsubmit="setA(this)">
<input name="a1" type="checkbox" id="a1" value="1" >
<input name="a1" type="checkbox" id="a2" value="1" >
<input name="a1" type="checkbox" id="a3" value="1" >
<input name="a1" type="checkbox" id="a4" value="1" >
<input name="a1" type="checkbox" id="a5" value="1" >
<input name="a1" type="checkbox" id="a6" value="1" >
<input type="hidden" name="a" />
</form>