如何解决使用 Window.print 在 Firefox 浏览器中打印 Html
这在 Google Chome 上运行良好。 当第一次使用 Firefox 时,表格行丢失,对齐也没有按预期显示。第二次它工作正常
<script language="javascript">
function PrintElem(elem) {
document.getElementById('PrintBtn').style.visibility = 'hidden';
var mywindow = window.open('','PRINT','height=400,width=600');
mywindow.document.write('<html><head><title></title>');
mywindow.document.write('</head><body >');
/*mywindow.document.write('<h1>' + document.title + '</h1>');*/
mywindow.document.write(document.getElementById(elem).outerHTML);
mywindow.document.write('</body></html>');
mywindow.document.close();
mywindow.focus();
mywindow.print();
setTimeout(function () { mywindow.close(); },10000);
document.getElementById('PrintBtn').style.visibility = 'visible';
return true;
}
//document.getElementById("printMe").style.height = (window.screen.height) - 100 + "px";
//document.getElementById("printMe").style.width = (window.screen.width) - 0 + "px";
//document.getElementById("printMe").style.overflowY = "auto";
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。