javascript - window.print 不打印 IE 中的所有页面

标签 javascript html css

我有一个包含 iframe 的页面,我想使用 window.print() 打印它们,它在 chrome 中工作,但在 IE 中不工作,它只打印第一页而不是其余页面。 this is the exact page that i want to print![][1] 它只打印出第一页而不是其他 5 页。 任何帮助将非常感激!

最佳答案

不清楚您的情况,但可以提供帮助,在 IE window.print 中,与 chrome 和 firefox 不同,print 将始终尝试打印浏览器窗口,而不是您所在的 iframe 窗口。 要在 IE 中打印相应的 iframe 窗口,请执行以下操作。

window.top.document.getElementById("iframe-id").contentWindow.focus(); window.top.document.getElementById("iframe-id").contentWindow.print();

希望这对您有所帮助。

关于javascript - window.print 不打印 IE 中的所有页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31556426/

相关文章:

javascript - 在javascript中获取div位置(顶部)?

javascript (window.open) 在所有浏览器中打开最大化,但在 chrome 中不打开

html - 基于子元素居中div

html - 在 IE9 中未从打印中删除按钮元素

javascript - jQuery isEmpty 不起作用

javascript - 获取 JavaScript 变量的字面值

javascript - javascript类定义之间有什么区别?

.net - 如果javascript被禁用,如何在服务器上检查?

html - 表格内容错位

javascript - 抛出前一帧信息