【发布时间】:2014-06-16 07:41:04
【问题描述】:
当我尝试在“Google Chrome”中打印页面时,它没有显示任何内容,但内容显示在“Mozilla Firefox”中。可能是什么原因?
以下是我用来打印页面特定部分的“javascript”代码 -
function printItemsLevel(tableClass){
var html="<html>";
html+='<link rel="Stylesheet" type="text/css" href="{{ asset('css/bootstrap.css') }}"></link>';
html+='<link rel="Stylesheet" type="text/css" href="{{ asset('css/bootstrap-theme.css') }}"></link>';
html+= document.getElementsByClassName(tableClass)[0].innerHTML;
html+="</html>";
var printWin = window.open('','','left=0,top=0,width=960,height=960,toolbar=0,scrollbars=0,status =0');
printWin.document.write(html);
printWin.document.close();
printWin.focus();
printWin.print();
printWin.close();
}
先谢谢了。
【问题讨论】:
-
我已经更新了我的答案.. 让我知道是否可行
标签: javascript google-chrome printing