怎么让这三个checkbox只能选择一个,当选择一个的时候其他选择的就取消<input type ="checkbox" id="CheckBox1" runat="server" />
                  
 <input type ="checkbox" id="CheckBox2" runat="server"  />
           
 <input type ="checkbox" id="CheckBox3" runat="server"   />
           
         
             
               

解决方案 »

  1.   

    那你干嘛要用checkbox啊就用radio呗
      

  2.   

    用radio,或者在利用事件,选中一个值把其他的取消~~
      

  3.   

    你如果非得要这样麻烦,那就每个checkbox后面都加个处理事件,选中一个让其它的checkbox的checked值为false
      

  4.   


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    <script src="http://code.jquery.com/jquery-latest.js"></script>
    <script>
    $(document).ready(function(){
    $(".checkbox").change(function(){
    if($(this).is(":checked")){
    $(this).siblings().attr("checked",false);
    }
    })
    });
    </script>
    </head>
    <body>
    <div id="main">
        <input type ="checkbox" class="checkbox" id="CheckBox1" runat="server" />
        <input type ="checkbox" class="checkbox" id="CheckBox2" runat="server" />
        <input type ="checkbox" class="checkbox" id="CheckBox3" runat="server" />
    </div>
    </body>
    </html>jquery,不过你直接拷到你的页面就可以用
      

  5.   

    两种方式都可以。单选也行。用jquery来处理也行。
      

  6.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    </head>
    <body>
    <div id="main">
        <input type ="checkbox" class="checkbox" id="CheckBox1" runat="server" onclick="document.getElementById('CheckBox2').checked=false;document.getElementById('CheckBox3').checked=false;"/>
        <input type ="checkbox" class="checkbox" id="CheckBox2" runat="server" onclick="document.getElementById('CheckBox1').checked=false;document.getElementById('CheckBox3').checked=false;"/>
        <input type ="checkbox" class="checkbox" id="CheckBox3" runat="server" onclick="document.getElementById('CheckBox1').checked=false;document.getElementById('CheckBox2').checked=false;"/>
    </div>
    </body>
    </html>