本帖最后由 tianhandigeng1498 于 2010-11-30 00:16:42 编辑

解决方案 »

  1.   

    $("td:checkbox").each(function(){this.checked=true});
      

  2.   


     $(document).ready(function(){
    <%--全选全不选--%>
    $("input[name='checkbox']").click(function(){
    if($(this).attr("checked") == true){
                            $("input[id='single']").attr("checked",$(this).attr("checked"));            
    }else{
    $("input[id'single']").attr("checked",false);
    }
    });
    });
      

  3.   

    $("input[name='checkbox']").each(function(){this.checked=true});
      

  4.   

    实现全选和反选
    $('#single').bind('click',function(){
        if(this.checked){
            $('td:checkbox').each(function(i){
                $(this).attr('checked',true);
            });
        }else{
            $('td:checkbox').each(function(i){
                $(this).attr('checked',false);
            });
        }
    });
    思路有很多种,你参考下,不过没有测试。
      

  5.   

    把$('#single')换成$('#all');绑定一个click事件,如果选中,则td 下面的checkbox属性都设为true,否则false;