如题。JQUERY我不熟悉。最好完全按照JQUERY的方式。JS和HTML分开的形式。

解决方案 »

  1.   


    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>
        <script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
        <script src="Scripts/JScript.js" type="text/javascript"></script>
    </head>
    <body>
        <table id="tab">
            <tr>
                <td>
                    <input type="checkbox" id="ssssss" />
                </td>
                <td>
                    <input type="checkbox" id="Checkbox1" />bbb
                </td>
                <td>
                    <input type="checkbox" id="Checkbox2" />cccc
                </td>
            </tr>
            <tr>
                <td>
                    <input type="checkbox" id="Checkbox3" />
                </td>
                <td>
                    <input type="checkbox" id="Checkbox4" />eee
                </td>
                <td>
                    <input type="checkbox" id="Checkbox5" />ffff
                </td>
            </tr>
            <tr>
                <td>
                    <input type="checkbox" id="Checkbox6" />
                </td>
                <td>
                    <input type="checkbox" id="Checkbox7" />hhhh
                </td>
                <td>
                    <input type="checkbox" id="Checkbox8" />jjjj
                </td>
            </tr>
        </table>
    </body>
    </html>
    <script>
        $(function () {
            //查找id=tab的表格,下面所有的tr,下面的所有td,第一个td下面复习框的点击事件。
            $("#tab tr>td:nth-child(1)").find("input[type='checkbox']").bind("click", function () {
                if ($(this).attr("checked") == true) {
                    $(this).parent().nextAll().find("input[type='checkbox']").attr("checked", true);
                }
                else {
                    $(this).parent().nextAll().find("input[type='checkbox']").attr("checked", false);
                }
            })
        })
    </script>
      

  2.   

    楼上啊jquery讲究的就是write less do more 
    你写那么多,用的可不是jquery的思想啊其实一句话就能搞定的。就你的html代码,实现  本行全选与全不选。$(function(){
        $("input[type=checkbox]").click(function(){        $(this).parent().parent().find("input[type=checkbox]").attr("checked",$(this).attr("checked"));
        });
    });
      

  3.   

    照你这样说那还可以精简些
    $(this).parent().parent(input[type=checkbox]).attr("checked",$(this).attr("checked"));
      

  4.   

    楼主只是说同一行的,而没有具体说页面的布局,如果他页面布局有改动,jQuery代码是要随着改的!
      

  5.   

    $("#selectall").click(function() { 
    $("input[@name='shareuser']").each(function() { 
    $(this).attr("checked", true); 
    }); 
    }); <input type='checkbox' id='in-shareuser-10' name='shareuser' value='10' />10 
    <input type='checkbox' id='in-shareuser-11' name='shareuser' value='11' />11
    <input type='checkbox' id='in-shareuser-12' name='shareuser' value='12' />12 
    <input type="button" id="selectall" name="selectall" value="全选" /> 
      

  6.   

    你的把布局说出来才能给你说具体的,你想实现的是全选吧
    思路就是给全选复选框一个点击事件,其他的复选框设为同一个class,点击后这个class选中。
    全选复选框id='xx';其他复选框class='ss';$('#xx').click(function(){
          $(‘.ss’).attr('checked', true);},function(){
          $('.ss').attr('checked',false);})
      

  7.   

    方法很多种。我说的是本行。代码我就不贴出来了。CSDN的效率不高,网上的例子改的。还是谢谢大家。思路都蛮好的。