javascript触发服务器控件Button的单击事件报错怎么解决
cs中protectedvoidPage_Load(objectsender,EventArgse){this.CheckBoxList1.Items[i].Attrib...
cs中 protected void Page_Load(object sender, EventArgs e)
{ this.CheckBoxList1.Items[i].Attributes.Add("onclick", "shuju();");}
aspx中
<div id ="xianshi" class="toumong">
<asp:Button ID="Button1" name="Button1" runat="server" onclick="Button1_Click" Text="Button" />
</div>
<script type="text/javascript">
function shuju() {document.getElementById("Button1").Click();//Microsoft JScript 运行时错误: 无法获取属性“Click”的值: 对象为 null 或未定义
}
</script> 展开
{ this.CheckBoxList1.Items[i].Attributes.Add("onclick", "shuju();");}
aspx中
<div id ="xianshi" class="toumong">
<asp:Button ID="Button1" name="Button1" runat="server" onclick="Button1_Click" Text="Button" />
</div>
<script type="text/javascript">
function shuju() {document.getElementById("Button1").Click();//Microsoft JScript 运行时错误: 无法获取属性“Click”的值: 对象为 null 或未定义
}
</script> 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询