既然之允许选一个为什么不用
<input type="radio" value="1" name="onle">
<input type="radio" value="2" name="onle">
<input type="radio" value="3" name="onle">

解决方案 »

  1.   

    <body>
    <input type=checkbox name=c>
    <input type=checkbox name=c> 
    <input type=checkbox name=c> 
    <input type=checkbox name=c> 
    <input type=checkbox name=c> 
    <input type=checkbox name=c> 
    <input type=checkbox name=c> 
    <input type=checkbox name=c> 
    <input type=checkbox name=c> 
    <script> 
    document.onclick=check;
    function check(){
    var num=0;
    for (i=0;i<document.all.c.length;i++){
    if(document.all.c[i].checked){
    num++
    if (num>1){
    event.returnValue=false;
    }
    }
    }
    }
    </script></body>
      

  2.   

    挨个判断是否被选
    function Check(){
    k =0;
    for(i=0;i<document.myForm.elements.length;i++)
    {
     if(document.myForm.elements[i].type == 'checkbox')
       if(document.myForm.elements[i].checked && ( (k++) > 1 ) ) return false; }
    return true;
    }