标签:
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <script language="javascript"> function sel(obj,group){ var list = []; var groups = 2;//每一组的个数 //定义的时候按最多的算不够的用0填充 var _TheArray = [ [document.getElementById("id1"),document.getElementById("id2")], [document.getElementById("id3"),0], [document.getElementById("id4"),document.getElementById("id5")] ] for (var i=0;i<_TheArray.length;i++) { if(_TheArray[i][0] == obj || _TheArray[i][1] == obj )//不对选中项的同组进行操作 { continue; } for(var k = 0; k < groups; k++) { _TheArray[i][k].checked = false; } } } </script> </head> <body>第一组: r1<input type="checkbox" name="r1" group="r1" id="id1" onClick="sel(this,‘r1‘)"/>
r2<input type="checkbox" name="r1" group="r1" id="id2" onClick="sel(this,‘r1‘)"><br/>
  第二组: r3<input type="checkbox" name="r2" group="r2" id="id3" onClick="sel(this,‘r2‘)"><br/>
第三组: r4<input type="checkbox" name="r3" group="r3" id="id4" onClick="sel(this,‘r3‘)">
r5<input type="checkbox" name="r3" group="r3" id="id5" onClick="sel(this,‘r3‘)"><br/> </html>
标签:
原文地址:http://www.cnblogs.com/zheh/p/4976312.html