<form name="form1" method="post" action=""><input type="checkbox" name="t1" value=""/>
<input type="checkbox" name="t1" value=""/>
<input type="checkbox" name="t1" value=""/>
<input type="checkbox" name="t1" value=""/>
<input type="checkbox" name="t1" value=""/>
<input type="checkbox" name="t1" value=""/>
</form>
<script language="javascript" type="text/JavaScript">
form1.onclick=function (){
var o=event.srcElement;
var e = form1.elements;
for(var i=0; i<e.length; i++)
if(e[i]!=o)e[i].disabled=(!o.checked)?false:true;
    }
</script>

解决方案 »

  1.   

    问题又来了,如果页面有button呢?可不可以只对checkbox的onclick判断啊?ps:我是js菜鸟哈。
      

  2.   

    <form name="form1" method="post" action=""><input type="checkbox" name="t1" value=""/>
    <input type="checkbox" name="t1" value=""/>
    <input type="checkbox" name="t1" value=""/>
    <input type="checkbox" name="t1" value=""/>
    <input type="checkbox" name="t1" value=""/>
    <input type="checkbox" name="t1" value=""/>
    <input type="radio" name="t2" value=""/>
    <input type="radio" name="t2" value=""/>
    <input type="submit" value="Submit" name="t3"/>
    </form>
    <script language="javascript" type="text/JavaScript">
    form1.onclick=function (){
    var o=event.srcElement.type=='checkbox'?event.srcElement:'';
    var e = form1.elements;
    if(event.srcElement.name=='form1' || o=='')return;
    for(var i=0; i<e.length; i++){
    if(e[i]!=o && e[i].type=='checkbox')e[i].disabled=(!o.checked)?false:true;
    }
        }
    </script>