[英]javascript script works in Firefox, Chrome, Safari, Internet Explorer < 9, but not in IE 9
[英]Javascript printing a popup window works in Firefox/Chrome but not Internet Explorer
以下代碼行在瀏覽器彈出窗口中創建一個html頁面,然后為用戶打印彈出窗口:
function printPage(htmlPage)
{
var w = window.open("about:blank");
w.document.write(htmlPage);
w.print();
}
此代碼在Firefox和Chrome中成功打開了一個打印對話框。 但是,在IE中,不顯示打印對話框。 有什么建議么?
我也嘗試在調用print()后關閉彈出窗口,正如其他人建議修復問題一樣:
function printPage(htmlPage)
{
var w = window.open("about:blank");
w.document.write(htmlPage);
w.print();
w.close();
}
無濟於事。
在嘗試print()
之前close()
document
。
function printPage(htmlPage)
{
var w = window.open("about:blank");
w.document.write(htmlPage);
w.document.close();
w.print();
}
適用於IE9 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.