zoukankan      html  css  js  c++  java
  • 一个比较实用的服务器端模拟客户端Alert的代码

    public class Alert
    {
        public Alert()
        {
           
        }

        public static void Show(string message)
        {
            // Cleans the message to allow single quotation marks
            string cleanMessage = message.Replace("'", "\\'");
            string script = "<script type=\"text/javascript\">alert('" + cleanMessage + "');</script>";
            // Gets the executing web page
            Page page = HttpContext.Current.CurrentHandler as Page;

            // Check if the handler is a Page and that the script isn't allready on the page
            if (page != null && !page.ClientScript.IsClientScriptBlockRegistered("alert"))
            {
                page.ClientScript.RegisterClientScriptBlock(typeof(Alert),"alert",script);
            }
        }

        public static void Show()
        {
            throw new Exception("The method or operation is not implemented.");
        }
    }

  • 相关阅读:
    SQL*Loader-951错误
    excel导出
    zookeeper常见bug
    可编辑表格
    tree的应用
    join
    hibernate manytomany 双向
    hibernate 多对多 单向关联
    hibernate 一对多(多对一)双向
    hibernate one2many
  • 原文地址:https://www.cnblogs.com/Koy/p/1228332.html
Copyright © 2011-2022 走看看