jquery实现让所有的checkbox全选反选

 <script src="../Js/jquery-1.6.4.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $("#all_check").click(function () {
                if ($("#all_check").attr("checked")) {
                    $("#joblisttable").find(":checkbox").each(function () {
                        if ($(this).attr("id") != "all_check")
                            $(this).attr("checked", true);
                    });
                } else {
                    $("#joblisttable").find(":checkbox").each(function () {
                        // if ($(this).attr("id") != "allcheck")
                        $(this).attr("checked", false);
                    });
                }
            });
        });
    </script>

posted on 2011-12-30 09:37  larryle  阅读(105)  评论(0)    收藏  举报