【发布时间】:2014-08-08 06:45:48
【问题描述】:
我必须使用 JQuery 在 Chrome 浏览器中打印 HTML din 及其内部 HTML。我尝试使用“printWindow.print()”函数,但它不起作用。我在页面上还有另一个按钮,所以在使用上述功能时,它会进入死锁状态,另一个按钮的点击事件不起作用。请提出一些可行的建议。
谢谢。
【问题讨论】:
-
您能否发布您的 HTML 和脚本代码,以便我们了解您要执行的操作?
-
你的意思是,你想打印出特定
<div>中的内容,还是别的什么? -
$(document).ready(function () { $("#btnContinue").click(function () { $("#btnPrint").click(function () { PrintDocuments($ ('#DivId').html()); }); function PrintDocuments(divContents) { var printWindow = window.open('', '_blank', 'height=400,width=800,,location=no') ; printWindow.document.write(divContents); printWindow.document.close(); printWindow.print(); return false; } });
标签: jquery google-chrome printing