这里是我的代码Javascript在asp.net web应用程序中确认框重定向?
Type cstype = this.GetType();
ClientScriptManager cs = this.ClientScript;
if (!cs.IsStartupScriptRegistered(cstype, "Script"))
{
String csScriptText = "confirm('Are you sure you want to leave the page');document.location='Default.aspx'";
cs.RegisterStartupScript(cstype, "TestScript", csScriptText, true);
}
我米试图实现我的web应用程序的confirmbox当用户点击signout按钮,出现......与选择确定,上述取消code.with上面的代码当用户点击confirmmbox上的“OK”时,我可以重定向到默认页面。当用户点击confirmmbox上的“取消”按钮时,我想保持在同一页面上。我该怎么做?
我也尝试添加条件,但仍任你点击“OK”或“取消”其重定向到默认当我点击确认框的“取消”时,我想保留在同一页面,当“ok”被点击时重定向到默认页面。 – Macnique