用Jquery实现全选后能够执行被选中的checkbox脚本事件!
时间:2011-12-02
来源:互联网
我的代码如下: 现在我实现了Checkbox 全选,但是一旦全选后我想执行被选上的脚本事件。 用Jquery实现[i][/i]!!!!
各位有什么好方法没! 我这个方法遍历的太多次了! 等十几秒才触发事件!!!!!
function chkShowCloum(sender, keyvalue) {
$("input[id$='txt" + keyvalue + "']").each(function() {
this.style.display = sender.checked ? "block" : "none";
});
$("[id$='lbl" + keyvalue + "']").each(function() {
this.style.display = sender.checked ? "none" : "block";
});
}
function chkShowDropDown(sender, keyvalue) {
$("select[id$='ddl" + keyvalue + "']").each(
function() {
this.style.display = sender.checked ? "block" : "none";
}
);
$("[id$='lbl" + keyvalue + "']").each(function() {
this.style.display = sender.checked ? "none" : "block";
});
}
function chkShowtextarea(sender, keyvalue) {
$("textarea[id$='txt" + keyvalue + "']").each(function() {
this.style.display = sender.checked ? "block" : "none";
});
$("[id$='lbl" + keyvalue + "']").each(function() {
this.style.display = sender.checked ? "none" : "block";
});
}
function chkShowSpan(sender, keyvalue) {
$("span[id$='txt" + keyvalue + "']").each(function() {
this.style.display = sender.checked ? "block" : "none";
})
$("[id$='lbl" + keyvalue + "']").each(function() {
this.style.display = sender.checked ? "none" : "block";
})
}
function chkShowtable(sender, keyvalue) {
$("table[id$='" + keyvalue + "']").each(function() {
this.style.display = sender.checked ? "block" : "none";
})
$("[id$='lbl" + keyvalue + "']").each(function() {
this.style.display = sender.checked ? "none" : "block";
})
}
function checkAllstate1(o) {
$("input[id^=FeesShow_ctl10_chkSdate]").each(function() {
$(this).attr("checked", o.checked);
chkShowSpan(this, 'Sdate');
chkShowSpan(this, 'Edate');
chkShowtable(this, 'CB');
chkShowDropDown(this, 'AirlineCompany');
chkShowDropDown(this, '_rateType');
chkShowDropDown(this, 'Dptype');
chkShowDropDown(this, 'VoyageType');
chkShowtextarea(this, 'SE');
chkShowtextarea(this, 'EE');
chkShowtextarea(this, 'AircomE');
chkShowtextarea(this, 'NoAircomE');
chkShowtextarea(this, 'Cabin2');
chkShowCloum(this, 'Discount');
chkShowCloum(this, 'RewardDiscount');
chkShowCloum(this, 'PolicyType');
})
}
<asp:CheckBox ID="chkSdate0" name="jquerys[]" runat="server" onclick="chkShowSpan(this,'Sdate');" />
<asp:CheckBox ID="chkSdate1" name="jquerys[]" runat="server" onclick="chkShowSpan(this,'Edate');" />
<asp:CheckBox ID="chkSdate2" name="jquerys[]" runat="server" onclick="chkShowtable(this,'CB');" />
<asp:CheckBox ID="chkSdate3" name="jquerys[]" runat="server" onclick="chkShowDropDown(this,'AirlineCompany');" />
<asp:CheckBox ID="chkSdate4" name="jquerys[]" runat="server" onclick="chkShowDropDown(this,'VoyageType')" />
<asp:CheckBox ID="chkSdate5" name="jquerys[]" runat="server" onclick="chkShowtextarea(this,'SE');" />
<asp:CheckBox ID="chkSdate6" name="jquerys[]" runat="server" onclick="chkShowtextarea(this,'EE');" />
<asp:CheckBox ID="chkSdate7" name="jquerys[]" runat="server" onclick="chkShowtextarea(this,'AircomE');" />
<asp:CheckBox ID="chkSdate8" name="jquerys[]" runat="server" onclick="chkShowtextarea(this,'NoAircomE');" />
<asp:CheckBox ID="chkSdate9" name="jquerys[]" runat="server" onclick="chkShowtextarea(this,'Cabin2');" />
<asp:CheckBox ID="chkSdate10" name="jquerys[]" runat="server" onclick="chkShowCloum(this,'Discount');" />
<asp:CheckBox ID="chkSdate11" name="jquerys[]" runat="server" onclick="chkShowCloum(this,'RewardDiscount');" />
<asp:CheckBox ID="chkSdate12" name="jquerys[]" runat="server" onclick="chkShowDropDown(this,'Dptype');" />
<asp:CheckBox ID="chkSdate13" name="jquerys[]" runat="server" onclick="chkShowCloum(this,'PolicyType');" />
<asp:CheckBox ID="chkSdate14" name="jquerys[]" runat="server" onclick="chkShowDropDown(this,'_rateType');" />
作者: yy2433720 发布时间: 2011-12-02
$(":checked").each(function(i,item){
$(item).change();
});
$(item).change();
});
作者: ifandui 发布时间: 2011-12-02
刚刚接触Jquery不怎么会! 不知道咋搞! 希望高手们一步步告诉我搞啊!
作者: yy2433720 发布时间: 2011-12-02
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28