脚本:
function bb(obj,name) {
var aa = document.getElementsByName(name);
for (var i = 0; i < aa.length; i++) {
aa[i].checked = false;
}
obj.checked = true;
}
前台:
<input type="checkbox" name="a" onclick="bb(this,'a')" />
<input type="checkbox" name="a" onclick="bb(this,'a')" />
<input type="checkbox" name="a" onclick="bb(this,'a')" />
<input type="checkbox" name="b" onclick="bb(this, 'b')" />
<input type="checkbox" name="b" onclick="bb(this, 'b')" />
<input type="checkbox" name="b" onclick="bb(this, 'b')" />