我試圖打開一個new
窗口和print
的內容。window.print()掛在Internet Explorer中
var parentHeader= $("head").html();
var parentDivContent = $("#printer_data_1").html();
var newW= window.open("", "", "scrollbars=1,width=200,height=200");
newW.document.write('<html><head><title>Title</title>'+parentHeader+'</head>');
newW.document.write('<body><div>');
newW.document.write(parentDivContent);
newW.document.write('</div></body></html>');
newW.document.close();
newW.print();
newW.close();
當我嘗試運行上述code
,它掛在IE8
,當我發表意見如下行......它的工作原理。
newW.document.write('<html><head><title>Title</title>'+parentHeader+'</head>');
我想將整個內容樣式加載到新窗口的頭部分。
我建議你看看這個網址的第三個答案:http://stackoverflow.com/questions/2555697/window-print-not-working-in-ie –