zoukankan      html  css  js  c++  java
  • window.showModalDialog 缓存和返回值的问题

      这次在开发过程中用到了模态弹出对话框,但这个函数会有缓存,很是烦恼,在网上查了查相关的资料,发现了一种解决的方法,在这里记录下,主要是在给弹出的窗口的页面加上个时间参数,这样就不会有缓存了,如下:

    一、缓存

    1、

    <meta http-equiv="pragma"   content="no-cache" />  
    <meta http-equiv="Cache-Control" content="no-cache,must-revalidate" />  
    <meta http-equiv="expires" content="Wed,26 Feb 1997 08:21:57 GMT" />

    2、

    <script language='javascript'>

    var time = new Date();

    window.showModalDialog("newWin.html?time="+time,"","");

    </script>

    二、返回值

    1、被调用的fish.html

    <html>

    <title>html</title>

    <head>

    <script>  
      function   sendTo()  {  
          window.returnValue   =   “deepfish”;
         window.close()  ;
      }  
    </script>

    </head>  
    <body>  
    <form>  
        <input   value="返回"   type=button   onclick="sendTo()">  
    </form>

    </body>

    </html>

    2、调用者html

    <html>

    <body>

    <script>

      var   tmp   =   window.showModalDialog("fish.htm")  
      alert(tmp);  

    </script>

    <body>

    </html>

  • 相关阅读:
    XidianOJ 1096 数的拆分
    XidianOJ 1183 Water Problem: Items divided
    XidianOJ 1182 Chinese Paladin – Qi’s troubles
    XidianOJ 1112 Too stupid
    XidianOJ 1120 Gold of Orz Pandas
    XidianOJ 1177 Counting Stars
    XidianOJ 1076 小W喜欢的数字
    XidianOJ 1095 派对
    XidianOJ 1055 如此遍历
    XidianOJ 1145 数学题
  • 原文地址:https://www.cnblogs.com/xmphoenix/p/2347037.html
Copyright © 2011-2022 走看看