您的位置:首页 > 编程语言 > ASP

asp.net 后台代码跳转页面前弹出提示框

2014-12-01 19:15 489 查看
1、Response.Write
("<script>alert('查询语句执行出错!');window.location.href=DisplayData.aspx</script>");


2、Page.RegisterStartupScript("msg", "<script>alert('查询语句执行出错!');window.location.href='DisplayData.aspx'</script>");
一般后台弹出提示框,都是用Page.RegisterStartupScript,不用Response.Write的

3、
ClientScript.RegisterStartupScript(this.GetType(), "", " <script
lanuage=javascript> alert('');location.href='';</script>");


4、
System.Web.HttpContext.Current.Response.Write(String.Format("<script
language=\"javascript\">alert(\"{0}\");window.location.replace(\"{1}\")</script>",
strMessage, strRedirectUrl));


5、ScriptManager.RegisterStartupScript(this, this.GetType(), "u1", "alert('内容!')", true);

6、Page.ClientScript.RegisterStartupScript(this.GetType(), "d", "alert('请先登录!');location='../login.aspx';", true);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: