Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/google-chrome/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript window.print有时打印空白页_Javascript_Google Chrome_Printing - Fatal编程技术网

Javascript window.print有时打印空白页

Javascript window.print有时打印空白页,javascript,google-chrome,printing,Javascript,Google Chrome,Printing,我使用google chrome打印动态网页,我使用kiosk打印它们我有这样的快捷方式“C:\Program Files(x86)\google\chrome\Application\chrome.exe”-kiosk打印问题是有时打印我的数据,但有时打印空白页,当您打印更多次空白数据时,这是不好的,因为我为每张票使用一个id,实际上我尝试用其他web示例打印,也是如此 ,但我把代码放在这里 var oldPage = document.body.innerHTML; var nhtm

我使用google chrome打印动态网页,我使用kiosk打印它们我有这样的快捷方式
“C:\Program Files(x86)\google\chrome\Application\chrome.exe”-kiosk打印
问题是有时打印我的数据,但有时打印空白页,当您打印更多次空白数据时,这是不好的,因为我为每张票使用一个id,实际上我尝试用其他web示例打印,也是如此 ,但我把代码放在这里

var oldPage = document.body.innerHTML;    
var nhtml ='<html><head></title><style> @page{size:auto;margin:4mm;}@media print { body {font-family:Arial;font-size:9pt;list-style:none;font-weight:bold }}'

nhtml=nhtml+'.stylo1{width:88mm;border-bottom:1px solid #333;border-top:1px solid #333;}.left{float:left;}';
nhtml=nhtml+'</style></head><body style="font-family:Arial;font-size:11pt;list-style:none;font-weight:bold"><div style="width:88mm;list-style:none;"><center></center>';
    
            for(var i = 0; i < data.length; i++) {
             nhtml=nhtml+ '<li><div class="stylo1">' + //data  +'</div></li>';
             for(var j = 0; j < data.Items.length; j++) {
                nhtml=nhtml+'<li><div class="detalle">'here i put data'</div></li><br>';
             }
            
            }
        
        
        document.body.innerHTML =nhtml;
        window.print();
            document.body.innerHTML = oldPage;
        setTimeout(function(){location.reload();},100);           
                      
                      
                
                
      
var oldPage=document.body.innerHTML;
var nhtml='@page{size:auto;margin:4mm;}@media print{body{font-family:Arial;字体大小:9pt;列表样式:无;字体重量:粗体}'
nhtml=nhtml+'.stylo1{宽度:88mm;边框底部:1px实心#333;边框顶部:1px实心#333;}.left{float:left;};
nhtml=nhtml+“”;
对于(变量i=0;i'+//data+'';
对于(var j=0;j”我把数据放在这里“
”; } } document.body.innerHTML=nhtml; window.print(); document.body.innerHTML=旧页; setTimeout(函数(){location.reload();},100);
请我需要修复它我有愤怒的客户:)