using System.Web; namespace DotNet.Utilities { /// /// 客户端脚本输出 /// public class JsHelper { /// /// 弹出信息,并跳转指定页面。 /// public static void AlertAndRedirect(string message, string toURL) { string js = ""; HttpContext.Current.Response.Write(string.Format(js, message, toURL)); HttpContext.Current.Response.End(); } /// /// 弹出信息,并返回历史页面 /// public static void AlertAndGoHistory(string message, int value) { string js = @""; HttpContext.Current.Response.Write(string.Format(js, message, value)); HttpContext.Current.Response.End(); } /// /// 直接跳转到指定的页面 /// public static void Redirect(string toUrl) { string js = @""; HttpContext.Current.Response.Write(string.Format(js, toUrl)); } /// /// 弹出信息 并指定到父窗口 /// public static void AlertAndParentUrl(string message, string toURL) { string js = ""; HttpContext.Current.Response.Write(string.Format(js, message, toURL)); } /// /// 返回到父窗口 /// public static void ParentRedirect(string ToUrl) { string js = ""; HttpContext.Current.Response.Write(string.Format(js, ToUrl)); } /// /// 返回历史页面 /// public static void BackHistory(int value) { string js = @""; HttpContext.Current.Response.Write(string.Format(js, value)); HttpContext.Current.Response.End(); } /// /// 弹出信息 /// public static void Alert(string message) { string js = ""; HttpContext.Current.Response.Write(string.Format(js, message)); } /// /// 注册脚本块 /// public static void RegisterScriptBlock(System.Web.UI.Page page, string _ScriptString) { page.ClientScript.RegisterStartupScript(page.GetType(), "scriptblock", ""); } } } //csharp/8617