zoukankan      html  css  js  c++  java
  • 页面的checkbox框的全选与反选

       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.each(function () {
            $(this).click(function () {
                if (this.checked == false) {
                    all[0].checked = false;
                }
            });
        });
    }
      使用
      
  • 相关阅读:
    数据结构实验之栈四:括号匹配
    数据结构实验之栈三:后缀式求值
    8月7日学习
    8月6日学习
    8月5日学习
    8月4日学习
    周总结
    8月3日学习
    8月2日学习
    8月1日学习
  • 原文地址:https://www.cnblogs.com/gaocong/p/4839308.html
Copyright © 2011-2022 走看看