我想打印 iframe 内容但我做不到,我找到了 url我是一个新的程序员,所以我没有理解问题和答案,请提前给我一些简单的
感谢
小智 5
这里是 :
你的 iframe :
<iframe id="printf" name="printf"></iframe>
Run Code Online (Sandbox Code Playgroud)
印刷 :
window.frames["printf"].focus();
window.frames["printf"].contentWindow.print();
Run Code Online (Sandbox Code Playgroud)
顺便说一句,下次尝试以更好的方式解释您的问题(发布代码可以提供帮助)=)
编辑 :
正如OP所说没有用,我指的是参考文献中链接的测试页:
你也可以试试这个功能(相同的参考,不同的海报):
//id is the id of the iframe
function printFrame(id) {
var frm = document.getElementById(id).contentWindow;
frm.focus();// focus on contentWindow is needed on some ie versions
frm.print();
return false;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
20212 次 |
| 最近记录: |