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

ASP.NET页面跳转

2010-04-20 11:46 1711 查看
代码 public static void AlertAndBack(string msg)
{
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.Write("<script>alert(\"" + msg.Replace("\"", "\\\"") + "\");window.history.back();</script>");
HttpContext.Current.Response.End();
}

public static void AlertAndGo(string msg, string gourl, string tager)
{
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.Write("<script>alert(\"" + msg.Replace("\"", "\\\"") + "\");window." + tager + ".location.href='" + gourl + "'</script>");
HttpContext.Current.Response.End();
}

public static void AlertAndRedirect(string msg, string gourl)
{
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.Write("<script>alert(\"" + msg.Replace("\"", "\\\"") + "\");window.location.href='" + gourl + "'</script>");
HttpContext.Current.Response.End();
}

public static void AlertAndClose(string msg)
{
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.Write("<script>alert(\"" + msg.Replace("\"", "\\\"") + "\");window.close();</script>");
HttpContext.Current.Response.End();
}
public static void Alert(System.Web.UI.Page p, string msg)
{
p.ClientScript.RegisterStartupScript(p.GetType(), "alert", "<script>alert(\"" + msg.Replace("\"", "\\\"") + "\");</script>");
}
public static void AlertAndRefresh(string msg)
{

HttpContext.Current.Response.Clear();
HttpContext.Current.Response.Write("<script>alert(\"" + msg.Replace("\"", "\\\"") + "\");history.go(-2);window.location.reload(); </script>");
//HttpContext.Current.Response.Write("<script>alert(\"" + msg.Replace("\"", "\\\"") + "\");parent.location.replace('DJIntegralAdmin.aspx'); </script>");
HttpContext.Current.Response.End();
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: