【问题标题】:Html form - iframe not working in firefox but works in IE7Html 表单 - iframe 在 Firefox 中不起作用,但在 IE7 中起作用
【发布时间】:2010-11-02 03:53:35
【问题描述】:

我的页面中有一个 html 表格、表单和一个隐藏的 iframe。在表格列(td)的 onclick 操作上,我在 iframe 中呈现 pdf 文档。

在 IE 中,这在后续点击时效果很好。但在 Firefox 中,它仅在第一次时有效,在随后的点击中,iframe 不会用最新数据刷新。

这是我的示例代码:

HTML 代码:

<div id="pdfdiv" style="visibility: hidden">
 <iframe width="100%" height="100%" scrolling="auto" name="pdfViewer"></iframe>
</div>

使用表单调用 iframe 的 JavaScript 代码:

--
--
 pdfdiv.style.visibility = "visible";//also set height and width
--
document.forms1.target="pdfViewer"; 
document.forms1.action="URL";
document.forms1.submit();

提前感谢您的帮助。

-芒果

【问题讨论】:

    标签: javascript html firefox


    【解决方案1】:

    代替可见性:隐藏,尝试“显示:无”和“显示:块”

    【讨论】:

      【解决方案2】:

      看起来框架的内容正在被缓存。解决它的一种方法是,如果您控制了服务器端代码,请在此处添加无缓存:

      <head>
      <meta http-Equiv="Cache-Control" Content="no-cache">
      <meta http-Equiv="Pragma" Content="no-cache">
      <meta http-Equiv="Expires" Content="0">
      </head>
      

      要做的另一件事:

      document.getElementById(FrameID).contentDocument.location.reload(true);
      

      【讨论】:

        猜你喜欢
        • 2010-10-18
        • 2015-06-16
        • 2015-07-09
        • 2012-11-27
        • 2011-03-24
        • 2011-05-03
        • 2012-01-20
        • 1970-01-01
        • 2014-10-18
        相关资源
        最近更新 更多