Javascript 如何使用for loop在同一页上打印1个二维码和1个数字?

Javascript 如何使用for loop在同一页上打印1个二维码和1个数字?,javascript,for-loop,printing,qr-code,Javascript,For Loop,Printing,Qr Code,我想使用for循环在同一页上打印1个qrcode和1个数字。但是我不能把QR码和数字写在同一页上 循环正在运行。 先写10个QR码。 然后打印10个数值。 我想在同一页上写1个qrcode和1个数字值 我使用的qrcode库 Javascript代码 for (i = 0; i < sayi; i++) { var list = [uc,uctwo,ucthree,ucfour,ucfive,ucsix,ucseven,uceight,ucnine,uct

我想使用for循环在同一页上打印1个qrcode和1个数字。但是我不能把QR码和数字写在同一页上

循环正在运行。 先写10个QR码。 然后打印10个数值。 我想在同一页上写1个qrcode和1个数字值

我使用的qrcode库

Javascript代码

for (i = 0; i < sayi; i++) {
 
            var list = [uc,uctwo,ucthree,ucfour,ucfive,ucsix,ucseven,uceight,ucnine,ucteen];
                  
    

   

    var qrcode = new QRCode(document.getElementById("printqrtwo"), {
    width : 50,
    height : 50
});
    

function makeCode () {      
    
    
     qrcode.makeCode(list[i].replace(/name|"|,|:|{|}/gi,""));
}
makeCode();

    
                theloop.innerHTML = theloop.innerHTML + list[i].replace(/name|"|,|:|{|}/gi,"")+ "<br/>";

    

       }

       function start() {
  

            var divContents = document.getElementById("printqr").innerHTML;
            var a = window.open('', '', 'height=500, width=500');
            a.document.open();
            a.document.write(divContents);
            a.document.close();
            a.print();
            location.reload();
            a.document.close();
                }       
                   setTimeout(start, 100);
(i=0;i{ 变量列表=[uc,uctwo,ucthree,ucfour,ucfive,ucsix,ucseven,uceight,ucnine,ucteen]; var qrcode=新的qrcode(document.getElementById(“printqrtwo”){ 宽度:50, 身高:50 }); 函数makeCode(){ makeCode(列表[i].replace(/name |“|,|:|{|}/gi,”)); } makeCode(); theloop.innerHTML=theloop.innerHTML+列表[i]。替换(/name |“|,|:{|}/gi,”)+“
”; } 函数start(){ var divContents=document.getElementById(“printqr”).innerHTML; 变量a=窗口打开('',''高度=500,宽度=500'); a、 document.open(); a、 文件。书写(内容); a、 document.close(); a、 打印(); location.reload(); a、 document.close(); } 设置超时(开始,100);
Html代码

 <div id="printqr" style="display: none;">  
      <div id="printqrtwo" style="margin-top:20px;"></div>
     <div id="printqrthree" style=""></div>
      </div>