我打印HTML低於打印格內容的JavaScript
<div id="DivIdToPrint" style="border:1px solid #000000;">
fdghgjhghjkjk
<div id="in">TO be are not to be that is the question</div>
</div>
和JavaScript代碼是:
function printDiv()
{
var divToPrint=document.getElementById('DivIdToPrint');
var newWin=window.open('','Print-Window','width=400,height=400,top=100,left=100');
newWin.document.open();
newWin.document.write('<html><body onload="window.print()">'+divToPrint.innerHTML+'</body></html>');
newWin.document.close();
setTimeout(function(){newWin.close();},10);
}
我想打印 「DivIdToPrint」 分區,但不 「在」 DIV內容顯示。
我很高興它爲你工作。謝謝。 –