如题,不是如花。。

解决方案 »

  1.   

    试下吧~~
    <script type="text/javascript"> 
    $(function() { 
     $("#checkall").click(function() { 
       $("input[name='checkname']").each(function() { 
          $(this).attr("checked", true); 
       }); 
     });  $("#delcheckall").click(function() { 
        $("input[@name='checkname[]']").each(function() { 
          $(this).attr("checked", false); 
        }); 
     }); 
    }); 
      </script> <input type='checkbox' id='id1' name='checkname' value='1' />value1 
    <input type='checkbox' id='id2' name='checkname' value='2' />value2 
    <input type='checkbox' id='id3' name='checkname' value='3' />value3 <input type="button" id="checkall" name="checkall" value="全选" /> 
    <input type="button" id="delcheckall" name="delcheckall" value="取消全选" /> 
      

  2.   

    上边有个地方没改 用这个
    <script type="text/javascript"> 
    $(function() { 
     $("#checkall").click(function() { 
       $("input[name='checkname']").each(function() { 
          $(this).attr("checked", true); 
       }); 
     });  $("#delcheckall").click(function() { 
        $("input[name='checkname']").each(function() { 
          $(this).attr("checked", false); 
        }); 
     }); 
    }); 
      </script> <input type='checkbox' id='id1' name='checkname' value='1' />value1 
    <input type='checkbox' id='id2' name='checkname' value='2' />value2 
    <input type='checkbox' id='id3' name='checkname' value='3' />value3 <input type="button" id="checkall" name="checkall" value="全选" /> 
    <input type="button" id="delcheckall" name="delcheckall" value="取消全选" /> 
      

  3.   

    <!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" />
    <script type="text/javascript" src="http://www.wanmei.com/public/js/jq_142.js"></script>
    <title>无标题文档</title>
    <script type="text/javascript">
    for(i=0;i<=10;i++)
    {
    document.write('<div id="aa">');
    document.write('<input type="checkbox" name="checkbox" value="checkbox"/> 复选框');
    document.write("<br />");
    document.write('</div>');
    };
    </script>
    <script type="text/javascript">
    $(document).ready(function(){  
     
    var count = 0;
    $('input[type=checkbox]').each(function(){
    $(this).click(function(){
    if($(this).attr('checked')){
    count++;
    if(count == 11){
    $('#a').attr('checked','true')
    }
    }else{
    count--;
    $('#a').removeAttr('checked')
    }
    })
    }); 

    $('#a').click(function(){
    if($(this).attr('checked')){
    $('input[type=checkbox]').each(function(){
    $(this).attr('checked','true');
    count = 11;
    })
    }
    })
         
    }); 
    </script>
    </head>
    <body>
    <input type="checkbox" id="a" />  全选</body></html>
      

  4.   

    <html>
    <head>    <script type="text/javascript" src="jquery/jquery.js"></script>    <script type="text/javascript">
        $(document).ready(function(){
            $("#checkall").click(function(){
                $("input[name='checkname']").attr("checked",$(this).attr("checked") || false);
            });
            var chks =  $("input[name='checkname']");
            chks.click(function(){
                for(var i =0 ; i < chks.length ; i++){    
                    if(!$(chks[i]).attr('checked')){
                        $("#checkall").removeAttr("checked");
                        return ;
                    }
                }
                $("#checkall").attr("checked",true);
            });
        });
        </script></head>
    <body>
        <input type='checkbox' id="checkall" name="checkall" />
        
        <br />
        <input type='checkbox' id='id1' name='checkname' value='1' />value1
        <input type='checkbox' id='id2' name='checkname' value='2' />value2
        <input type='checkbox' id='id3' name='checkname' value='3' />value3
    </body>
    </html>
      

  5.   


    <!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>
        <title></title>
        <script src="../Scripts/jquery-1.6.2.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(function () {
                $("input[name='hobby']").click(function () {
                    $("input[name='hobby']:checked").length == $("input[name='hobby']").length ? $("#checkAll").attr("checked", true) : $("#checkAll").attr("checked", false);
                });
                $("#checkAll").click(function () {
                    $("input[name='hobby']").attr("checked", this.checked);
                });
            });
        </script>
    </head>
    <body>
        <form action="test.htm" method="post">
        <input id="checkAll" type="checkbox" />全选
        <br />
        <input type="checkbox" name="hobby" value="1" />
        <input type="checkbox" name="hobby" value="2" />
        <input type="checkbox" name="hobby" value="1" />
        <input type="checkbox" name="hobby" value="1" />
        <input type="checkbox" name="hobby" value="1" />
        </form>
        
    </body>
    </html>
      

  6.   

    我一个页面有两个全选功能checkbox       checkboxlistcheckbox      checkboxlist
      

  7.   

    <!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" />
    <script type="text/javascript" src="http://www.wanmei.com/public/js/jq_142.js"></script>
    <title>无标题文档</title>
    <script type="text/javascript">
    document.write('aaaaaaaaaaaaaaaaa')
    document.write("<br />");
    for(i=0;i<=10;i++)
    {document.write('<input type="checkbox" name="checkbox" value="checkbox"/> 复选框');
    document.write("<br />");
    };
    </script>
    <script type="text/javascript">
    document.write('bbbbbbbbbbbbbbbbbb')
    document.write("<br />");
    for(i=0;i<=10;i++)
    {document.write('<input type="checkbox" name="cb" value="checkbox"/> 复选框');
    document.write("<br />");
    };
    </script>
    <script type="text/javascript">
    $(document).ready(function(){  
     
            var count = 0;
            $('input[name=checkbox]').each(function(){
                $(this).click(function(){
                    if($(this).attr('checked')){
                        count++;
                        if(count == 11){
                            $('#a').attr('checked','true')    
                        }
                    }else{
                        count--;
                        $('#a').removeAttr('checked')    
                    }
                })
            }); 
            
            $('#a').click(function(){
                if($(this).attr('checked')){
                    $('input[name=checkbox]').each(function(){
                        $(this).attr('checked','true');
                        count = 11;    
                    })    
                }else{
    $('input[name=checkbox]').each(function(){
                        $(this).removeAttr('checked')
                        count = 0;    
                    })  
    }  
            })
    var count1 = 0;
            $('input[name=cb]').each(function(){
                $(this).click(function(){
                    if($(this).attr('checked')){
                        count1++;
                        if(count1 == 11){
                            $('#b').attr('checked','true')    
                        }
                    }else{
                        count1--;
                        $('#b').removeAttr('checked')    
                    }
                })
            }); 
            
            $('#b').click(function(){
                if($(this).attr('checked')){
                    $('input[name=cb]').each(function(){
                        $(this).attr('checked','true');
                        count1 = 11;    
                    })    
                }else{
    $('input[name=cb]').each(function(){
                        $(this).removeAttr('checked')
                        count1 = 0;    
                    })  
    }
            })  
         
    }); 
    </script>
    </head>
    <body>
    <input type="checkbox" id="a" />  a全选
    <input type="checkbox" id="b" />  b全选</body></html>
      

  8.   

    我靠,北北,你太厉害了,http://topic.csdn.net/u/20110727/11/ea562191-49c2-41f7-a173-21e0072e10b9.html这个分也给你,你去留个言,加我QQ啊,437022466