打印html中指定内容

来源:互联网 发布:网络管理岗位说明书 编辑:程序博客网 时间:2024/06/08 14:17

js代码

var dy = document.getElementById("PrintA");
var winEx2 = window.open("", "winEx2", "width=800,height=600,status=yes,menubar=no,scrollbars=yes,resizable=yes");
winEx2.document.open("text/html", "replace");
winEx2.document.write(unescape(dy.innerHTML));
winEx2.print();
winEx2.document.close();
winEx2.close();

其中PrintA为指定内容的ID

原创粉丝点击