深海的小鱼儿

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

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

一、缓存

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>

posted on 2012-02-11 20:25  深海的小鱼儿  阅读(972)  评论(0编辑  收藏  举报