我使用 JavaScript,在执行过程中会出现这个错误:
Microsoft JScript runtime error: 'document.getElementById(...)' is null or not an object
这是我的代码:
<asp:Content ID="content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<script language="javascript" type="text/javascript">
function ConfirmTransfere() {
if (confirm("Syatem not allow negative inventory, would you like to continue ?") == true) {
document.getElementById("btnAlelrt").click();
}
}
</script>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="uxContainer" runat="server">
<ContentTemplate>
<table>
<tr>
<td>
<asp:Button ID="uxTransfer" runat="server" Text="Transfer" OnClick="uxTransfer_Click" />
<asp:Button ID="btnAlelrt" runat="server" Text="GetDetails" OnClick="btnAlelrt_Click" />
</td>
</tr>
</table>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="uxTransfer" />
</Triggers>
</asp:UpdatePanel>
</asp:Content>