• js 后台弹窗


    后台弹出操作成功,失败信息

      

    1         /// <summary>
    2         /// 弹出信息,并跳转指定页面。
    3         /// </summary>
    4         public static void AlertAndRedirect(string message, string toURL)
    5         {
    6             string js = "<script language=javascript>alert('{0}');window.location.replace('{1}')</script>";
    7             HttpContext.Current.Response.Write(string.Format(js, message, toURL));
    8             HttpContext.Current.Response.End();
    9         }    
    1          /// <summary>
    2         /// 弹出信息,并返回历史页面
    3         /// </summary>
    4         public static void AlertAndGoHistory(string message, int value)
    5         {
    6             string js = @"<Script language='JavaScript'>alert('{0}');history.go({1});</Script>";
    7             HttpContext.Current.Response.Write(string.Format(js, message, value));
    8             HttpContext.Current.Response.End();
    9         }    
    1   /// <summary>
    2         /// 直接跳转到指定的页面
    3         /// </summary>
    4         public static void Redirect(string toUrl)
    5         {
    6             string js = @"<script language=javascript>window.location.replace('{0}')</script>";
    7             HttpContext.Current.Response.Write(string.Format(js, toUrl));
    8         }
     1  /// <summary>
     2         /// 弹出信息 并指定到父窗口
     3         /// </summary>
     4         public static void AlertAndParentUrl(string message, string toURL)
     5         {
     6             string js = "<script language=javascript>alert('{0}');window.top.location.replace('{1}')</script>";
     7             HttpContext.Current.Response.Write(string.Format(js, message, toURL));
     8         }
     9 
    10         /// <summary>
    11         /// 返回到父窗口
    12         /// </summary>
    13         public static void ParentRedirect(string ToUrl)
    14         {
    15             string js = "<script language=javascript>window.top.location.replace('{0}')</script>";
    16             HttpContext.Current.Response.Write(string.Format(js, ToUrl));
    17         }
    18 
    19         /// <summary>
    20         /// 返回历史页面
    21         /// </summary>
    22         public static void BackHistory(int value)
    23         {
    24             string js = @"<Script language='JavaScript'>history.go({0});</Script>";
    25             HttpContext.Current.Response.Write(string.Format(js, value));
    26             HttpContext.Current.Response.End();
    27         }
    28 
    29         /// <summary>
    30         /// 弹出信息
    31         /// </summary>
    32         public static void Alert(string message)
    33         {
    34             string js = "<script language=javascript>alert('{0}');</script>";
    35             HttpContext.Current.Response.Write(string.Format(js, message));
    36         }
    37 
    38         /// <summary>
    39         /// 注册脚本块
    40         /// </summary>
    41         public static void RegisterScriptBlock(System.Web.UI.Page page, string _ScriptString)
    42         {
    43             page.ClientScript.RegisterStartupScript(page.GetType(), "scriptblock", "<script type='text/javascript'>" + _ScriptString + "</script>");
    44         }
  • 相关阅读:
    读《构建之法》8、9、10章有感
    评论
    复利计算器(4)——jQuery界面美化、自动补全
    送给搭档的“汉堡”
    MFC之TreeCtrl控件使用经验总结
    MFC绘制图片闪烁详解
    MFC 网络编程中::connect返回-1问题
    C++网络编程之select
    C++关于Condition Variable
    Mutex 和 Lock
  • 原文地址:https://www.cnblogs.com/dandanwozhishidan/p/3565966.html
Copyright © 2020-2023  润新知