javascript - 在 IE9 中打印 IFrame 文档

标签 javascript asp.net internet-explorer

我有一个 Iframe,我正在 Iframe 内显示 PDF,现在我必须打印 Iframe 单击“打印”按钮时的文档,它在 Crome 中工作正常,但在 IE9 中不工作

frames[0].focus(); 帧[0].print();

我在单击按钮时在 javascript 上使用此代码,它适用于 Crome,但不适用于 IE9。 这是 Iframe 标签:

<iframe id="myIframe"  name= "tabsa"   runat="server" src="PDFFilePage.aspx" height="800px"  width="100%"></iframe>

最佳答案

尝试将打印功能放入 Iframe 页面中 并从父级调用它

在 PDFFilePage.aspx 页面中

function PrintPDF() {
            Windows.Print();
        }

在父级中

frames[0].PrintPDF()

关于javascript - 在 IE9 中打印 IFrame 文档,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9835441/

相关文章:

javascript - 我应该在我的 meteor 文件中添加 "use strict"吗?

javascript - 在JS中,为什么不记录catch(err)中的参数显示完整的响应对象?

css - Win8 上的字体端IE 版本兼容性调试工具(从IE 8 9 10 11 轻松转换)是什么?

css - IE8 - 隐藏 CSS 溢出,修复导致 jquery 的进一步问题

javascript - 透明的谷歌齿轮场景验证

Javascript 循环遍历事件内的数组

asp.net - ASP.net HttpRuntime.Cache 使用的默认序列化是什么

asp.net 邮件添加 ReplyTo

asp.net - .net 4.7 中的 tls 1.2 不工作

internet-explorer - Internet Explorer 与 Chrome 缓存