如何在 JavaScript 中处理我的用户控件?
<body>
<form id="form1" runat="server">
<div>
<uc1:WebUserControl ID="WebUserControl1" runat="server" Enabled="False" />
<input id="Button1" type="button" value="button" runat="server" onclick="return Button1_onclick()" /></div>
</form>
<script type="text/javascript">
var pageDefault = {
uc: document.getElementById("<%=WebUserControl1.ClientID%>"),
btn1: document.getElementById("<%=Button1.ClientID%>"),
init: function() {
this.btn1.onclick = function() {
uc.setAttribute('Enabled', 'True'); //uc is null at this point
};
}
}
pageDefault.init();
</script>
</body>