我在我的网络控件上关注按钮,
<asp:Button runat="server" ID="btnSave" Text="Save" onclick="btnSave_Click" OnClientClick="myShowWaitScreenWithNoClose('Processing...', 'Saving survey.Please wait it may take minutes..');" CssClass="buttons" Height="46px" Width="212px" Visible="false" />
我正在尝试使用后面代码中的 JavaScript 单击此按钮。像,
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "scr", "setTimeout(function(){document.getElementById('btnSave').click(); return false;}, 180000);", true);
}
}
但它会引发错误Error: TypeError: document.getElementById(...) is null