页面两个checkbox :
<asp:CheckBox ID="CheckBox1" runat="server" />
<asp:CheckBox ID="CheckBox2" runat="server" />
我在后台让CheckBox1选中和不选中时这样写的:
this.CheckBox1.Attributes["onclick"] = "if(confirm('check ok ')){ShowCheck('0') ;}else{return false;}";
ShowCheck是js的一个方法:
function ShowInitialDFM(id) {
if (document.getElementById("CheckBox1").checked) {
document.getElementById("CheckBox2").checked = true;
}
}
没有起作用,CheckBox2没有选中 ,是不是因为我的两个CheckBox都放在 UpdatePanel 里面,
我该怎么弄?拿个button触发?