zoukankan      html  css  js  c++  java
  • 在web网页编程时常用的消息对话框总结

     以前编程时在写消息对话时,总是每到用的地方就来一个Response.Write("<scritp language='javascript'>alert('消息');</script>");
    为了减少代码的重写,总结了一下常用的对话框.
    public class WebMessageBox
    {
        /// <summary>
        /// 网页消息对话框
        /// </summary>
        /// <param name="Message">要显示的消息文本</param>
        public static void Show(string Message)
        {
            HttpContext.Current.Response.Write("<script language='javascript' type='text/javascript'>alert('" + Message + "')</script>");
            HttpContext.Current.Response.Write("<script>history.go(-1)</script>");
            HttpContext.Current.Response.End();
        }

        /// <summary>
        /// 网页消息对话框
        /// </summary>
        /// <param name="Message">要显示的消息文本</param>
        /// <param name="Src">点击确定后跳转的页面</param>
        public static void Show(string Message, string Src)
        {
            HttpContext.Current.Response.Write("<script language='javascript' type='text/javascript'>alert('" + Message + "');location.href='" + Src + "'</script>");
            HttpContext.Current.Response.End();
        }

        /// <summary>
        /// 网页消息对话框
        /// </summary>
        /// <param name="Message">要显示的消息文本</param>
        /// <param name="Close">关闭当前页面</param>
        public static void Show(string Message, bool Close)
        {
            if (Close)
            {
                HttpContext.Current.Response.Write("<script language='javascript' type='text/javascript'>alert('" + Message + "');window.close()</script>");
                HttpContext.Current.Response.End();
            }
            else
            {
                HttpContext.Current.Response.Write("<script language='javascript' type='text/javascript'>alert('" + Message + "')</script>");
                HttpContext.Current.Response.End();
            }
        }

  • 相关阅读:
    P2604 [ZJOI2010]网络扩容
    P2053 [SCOI2007]修车
    P2045 方格取数加强版
    P4134 [BJOI2012]连连看
    P2153 [SDOI2009]晨跑
    P3381 【模板】最小费用最大流
    P3376 【模板】网络最大流
    P1326 足球
    2020牛客多校第八场I题 Interesting Computer Game(并查集+判环)
    Codeforces 1375D Replace by MEX(思维题)
  • 原文地址:https://www.cnblogs.com/wenming205/p/1241414.html
Copyright © 2011-2022 走看看