ASP.NET页面跳转
2010-04-20 11:46 Leason Li 阅读(289) 评论(0) 编辑 收藏 举报代码
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();
}
{
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();
}
作者:leening_li
出处:http://www.cnblogs.com/leening/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。