用radio代替checkbox不更好。
<input type=radio name=kk>
<input type=radio name=kk>
<input type=radio name=kk>
<input type=radio name=kk>
隻可以選中一個

解决方案 »

  1.   

    这样写不是简单一些嘛?<INPUT type="checkbox" onclick=void_checkselect(this); name="type1">
    <INPUT type="checkbox" onclick=void_checkselect(this); name="type2">
    <INPUT type="checkbox" onclick=void_checkselect(this); name="type3">
    <INPUT type="checkbox" onclick=void_checkselect(this); name="type4"><script>
    function void_checkselect(obj)

    var box=document.getElementsByTagName("INPUT");
    for(i=0;i<box.length;i++)
    {
    if(box[i].type=="checkbox" && box[i].name.indexOf("type")!=-1)
    {
    if(obj.name!=box[i].name)
    box[i].checked=false;
    }
    }
    }
    </script>