我正在使用JavaScript编写类似以下代码的功能,在单击链接时打印页面的某个部分:
function printDiv() {
var divToPrint = document.getElementById('printArea');
var newWin = window.open();
newWin.document.write(divToPrint.innerHTML);
newWin.print();
newWin.close();
}
它在Firefox中运行得很好,但在IE中不行。
有人可以帮忙吗?