<input type="radio" >不是更简单????...

解决方案 »

  1.   

    onclick='Check(this)'fcuntion Check(obj)
    {
    var arys=document.getElementById("xx")
    for(var tmp in arys)
    {
    if(tmp==obj)
    {
    tmp.checked=true
    }
    else
    {
    tmp.checked=false
    }
    }
    }
      

  2.   

    似乎我写错了,应该是getElementsByName
      

  3.   

    简单写了一下,给你个思路:
    <div id='div1'>
    <input type='checkbox' name='info' value='1' onclick=chek(this)>1
    <input type='checkbox' name='info' value='2' onclick=chek(this)>2
    <input type='checkbox' name='info' value='3' onclick=chek(this)>3
    <input type='checkbox' name='info' value='4' onclick=chek(this)>4
    <input type='checkbox' name='info' value='5' onclick=chek(this)>5
    </div>
    <script>
    function chek(obj){
      cheks = document.getElementsByName('info');
      for(var i=0;i<cheks.length;i++){
        if(cheks[i] == obj){
      continue;
    }else{
      cheks[i].disabled = true;
    }
      }
     }
    </script>
      

  4.   

    cheks[i].disabled = true; 错了吧
    应该是 checked