kra*_*626 3 javascript asp.net alert
我有一个新页面,其中包含以下内容:Response.Redirect有效,但我手头没有得到弹出窗口...
有任何想法吗???
protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString["timeout"] != null && Request.QueryString["timeout"].ToString().Equals("yes"))
{
Response.Write("<script>alert('Your Session has Timedout due to Inactivity');</script>");
Response.Redirect("Default.aspx");
}
}
Run Code Online (Sandbox Code Playgroud)
该Response.Redirect
浏览器重定向和你的JavaScript没有得到执行.
尝试使用JavaScript重定向:
protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString["timeout"] != null && Request.QueryString["timeout"].ToString().Equals("yes"))
{
Response.Write("<script>" +
"alert('Your Session has Timedout due to Inactivity');" +
"location.href='Default.aspx';" +
"</script>");
}
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
565 次 |
最近记录: |