你的位置:首页 > Java教程

[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.not(":eq(0)").each(function () {      $(this).click(function () {        if (this.checked == false) {          all[0].checked = false;        }      });    });  }