【发布时间】:2019-02-26 20:46:50
【问题描述】:
我找到了这个打印解决方案:
function Print() {
if (document.queryCommandSupported('print')) {
document.execCommand('print', false, null);
}
else {
window.parent.<framename>.focus();
window.print();
}
}
虽然我有几个 iframe 而不是只有一个。为多个 iframe 编写该代码的最佳方式是什么?
【问题讨论】:
-
您的打印命令是从 iframe 执行的?
-
没有。那就是问题所在。我当前的打印按钮适用于多个 iframe:
-
函数 printall() { window.print(); for (var i=0; i
-
我正在尝试合并 document.execCommand('print', false, null) 而不是我拥有的
-
您的意思是要对每个 iframe 使用 document.execCommand() 方法,并逐个打印每个 iframe?
标签: javascript iframe printing internet-explorer-11