window.Print()打印功能,火狐正常,IE浏览器中css样式无效
代码:
function Print() {
document.getElementById("btnPrint").style.display="none";
bdhtml = window.document.body.innerHTML;
sprnstr = "<!--startprint-->";
eprnstr = "<!--endprint-->";
prnhtml = bdhtml.substr(bdhtml.lastIndexOf(sprnstr));
prnhtml = prnhtml.substring(0, prnhtml.lastIndexOf(eprnstr));
window.document.body.innerHTML = prnhtml;
window.print();
}
还是使用打印组件比较好