首页 > 其他 > 详细

页面的checkbox框的全选与反选

时间:2015-09-25 20:22:45      阅读:240      评论:0      收藏:0      [点我收藏+]
   if (typeof jQuery == ‘undefined‘) {

        alert("请先导入jQuery");
    } else {
        jQuery.extend({
            quan_fan: quan_fan

        });
    }
    function quan_fan(all,other)
    {
        /// <summary>
        ///         全选,反选
        /// </summary>
        /// <param name="all">全选(按钮(checkbox))JQuery对象</param>
        /// <param name="other">其它(按钮(checkbox))JQuery对象</param>
        all.click(function () {
            if (all[0].checked == true) {
                other.each(function () {
                    this.checked = true;
                });
            }
            else {
                other.each(function () {
                    this.checked = false;
                });
            }
        });
        other.not(":eq(0)").each(function () {
            $(this).click(function () {
                if (this.checked == false) {
                    all[0].checked = false;
                }
            });
        });
    }

 

页面的checkbox框的全选与反选

原文:http://www.cnblogs.com/gaocong/p/4839308.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!