这段代码在 Firefox 和 ie 中工作,但在 chrome 中没有。请建议。
函数打印数据(){
var printHtml = "";
printHtml = printHtml + "<html>";
printHtml = printHtml + "<head>";
printHtml = printHtml + "<title>www.MyDomain.com</title>";
printHtml = printHtml + "<style>body{background:#fff;} .allow_border td{border:1px solid #000; padding:2px 5px;} div{text-align:left;}</style>";
printHtml = printHtml + "</head>";
printHtml = printHtml + "<body>";
printHtml = printHtml + "<div>";
printHtml = printHtml + document.getElementById("divPrintArea").innerHTML;
printHtml = printHtml + "</div>";
printHtml = printHtml + "</body>";
win = window.open('XXXXXXX', 'XXXXXXX', 'width=1,height=1,left=250,top=250');
win.document.write(printHtml);
win.document.close();
win.focus();
win.print();