zoukankan      html  css  js  c++  java
  • 在一般处理程序(ashx)中弹出js提示语

    在提交form表单时,比如前台是$("form").submit()同步提交的时候,这个是没有回掉函数的,那么我们只能在后台提示,在前台显示,自己作为一个参考吧
      public class Script
            {
                public static void Alert(string message)
                {
                    ResponseScript("alert('" + message + "');window.location = '弹出提示语后,点击确认跳到你想跳的页面';");
                }
                public static void ResponseScript(string script)
                {
                    HttpContext.Current.Response.Write("<script type="text/javascript">
    //<![CDATA[
    ");
                    HttpContext.Current.Response.Write(script);
                    HttpContext.Current.Response.Write("
    //]]>
    </script>
    ");
                }
            }
    

      

    还有就是将一般处理程序默认的 //context.Response.ContentType = "text/plain";改为
                context.Response.ContentType = "text/html";
    

      

    我们调用的时候直接:
    
    Script.Alert("你的提示语!");
    

      

  • 相关阅读:
    Java遍历Map、List、Array
    自签名SSL生成
    oracle_round
    Timestamp_时间戳
    oracle_substr
    eval
    orcale_聚合函数
    oracle_decode
    js_JSON
    sql拼接
  • 原文地址:https://www.cnblogs.com/hbh123/p/6218671.html
Copyright © 2011-2022 走看看