  | 
              
	              
	                
  
    
	 
        ท่านใดช่วยต่อให้ด้วยครับ ปัญหาเดิมครับ วนลูป Barcode แล้ว ยังไม่เปลี่ยน ตาม ที่วนครับ     | 
   
  
    |   | 
   
 
 
 
	
		
			  | 
	   | 
	    | 
		
			  | 
	 
	
		
			  | 
		 		   | 
	  	    
          
            
			
	
			
			 
                คือว่ลองทำมาอยู่นานแล้วครับ ไม่สามารถทำได้ มีอีกแบบ คือว่า ทำได้ วนตาม แต่ barcode ยิงได้ บ้างอัน คือแบบนี้ครับ 
Code (PHP) 
<script language="JavaScript">document.open();Code39(500,100,30,5,"<?php echo $resultpoonline['PONO'];?>",2);</script>
  
 
แต่ถ้าอันล่างยิงได้หมดเลย เพราะเป็นรูปภาพ แต่ก็ ข้อมูลมาแค่บรรทัดเดียวนะครับ รบกวนช่วยด้วยครับ ได้อย่างไม่ได้อย่าง เซงจริงๆๆ อยากได้แบบที่ 2 ยิงได้หมด แต่ข้อมูลออกบรรทัดเดียวนะครับ  
 
Code (PHP) 
 
<td height="36" valign="top" class="td" style="font-size: 38px;" >					
                   <img id ="barcode">  		  
					<script language="JavaScript">  
					function  repeat(obj,str_barcode)
						{
							JsBarcode(obj,str_barcode,{width:2,height:20,displayValue:true,fontSize:10});
						}
                    	document.open();repeat("#barcode","<?php echo $resultpoonline['PONO'];?>");  
                    </script>   
				   </td> 	
 
 
  Tag : PHP, Ms SQL Server 2005               
                        | 
           
          
            
		
  ประวัติการแก้ไข 2018-05-09 11:20:14	
                             | 
           
          
            
              
                   | 
                   | 
                   | 
               
              
                   | 
                
                    
                      | Date :
                          2018-05-09 11:19:11 | 
                      By :
                          owenback | 
                      View :
                          748 | 
                      Reply :
                          7 | 
                     
                  | 
                   | 
               
              
                   | 
                   | 
                   | 
               
              | 
           
          
            | 
			 | 
           
         
	    
		             | 
		
			  | 
	 
	
		
			  | 
		  | 
		
			  | 
		
			  | 
	 
 
              
  
          
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ขอภาพประกอบหน่อยครับ ยังงงๆ                        
               
               | 
             
            
              
			  			  
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-05-10 10:07:19 | 
                        By :
                            mr.win | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 อันนี้รูปครับ 
 
  
 
 
Code แบบนี้ครับ  
 
Code (PHP) 
<img id ="barcode">  		  
					<script language="JavaScript">  
					function  repeat(obj,str_barcode)
						{
							JsBarcode(obj,str_barcode,{width:2,height:20,displayValue:true,fontSize:10});
						}
                    	document.open();repeat("#barcode","<?php echo $resultpoonline['PONO'];?>");  
                    </script>  
 
 
รบกวนด้วยครับ                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-05-10 11:15:49 | 
                        By :
                            owenback | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 คุณเอา php ไปผสมกับ javascript  
 
ให้ตรวจสอบชุดคำสั่ง javascript ที่ได้ฝั่ง client ว่ามาถูกต้องหรือไม่ โดยใช้คำสั่ง view source ของ browser                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-05-10 14:13:44 | 
                        By :
                            Chaidhanan | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ผมลอง view source ตามที่ Chaidhanan ว่า ก็ออกมาวนออกมานะครับ  
 
 
Code (PHP) 
  <img id ="barcode">  		  
					<script language="JavaScript">  
					function  repeat(obj,str_barcode)
						{
							JsBarcode(obj,str_barcode,{width:2,height:20,displayValue:true,fontSize:10});
						}
                    	document.open();repeat("#barcode","1100107440");  
                    </script>  
				   </td> 					
                    <td class="td" style="font-size: 12px;">122020C</td>
                    <td class="td" style="font-size: 12px;">MT300398C</td>
                    <td class="td" align="center" style="font-size: 12px;">12.000</td>
                    <td class="td" align="center" style="font-size: 12px;">23/03/2018</td>
                    <td class="td" align="center" style="font-size: 12px;">26/04/2018</td>    
                    
                  	<td height="36" valign="top" class="td" style="font-size: 38px;" >
					
                    <!--<img id="barcode2"/>
									
                    <script>
                    var repeat5 = function()
					{
						
                    JsBarcode("#barcode2","12",{width:2,height:18,displayValue:true,fontSize:10});
                    };
                    setInterval(repeat5,5000);   
                    repeat5();
                    </script>  -->
					<script language="JavaScript">document.open();Code39(500,100,30,5,"12",2);</script>
                    </td>   
                    
                </tr>               
                <tr>
                    <td height="36" valign="top" class="td" style="font-size: 38px;" >
                   <!-- <img id="barcode3"/>
                    <script>
                    var repeat5 = function(){
                    JsBarcode("#barcode3","10",{width:2,height:18,displayValue:true,fontSize:10});
                    };
                    setInterval(repeat5,5000);   
                    repeat5();
                    </script>  -->
                        <script language="JavaScript">document.open();Code39(500,100,30,5,"10",2);</script>					
                    </td> 
                    <td colspan="3" class="td" style="font-size: 12px;">PIPE(TOWER)[EDW(ST)]</td>
                    <td colspan="2" class="td" style="font-size: 12px;">1</td>
                    <td height="36" valign="top" class="td" style="font-size: 38px;" >
                    <!--<img id="barcode4"/>
                    <script>
                    var repeat5 = function(){
                    JsBarcode("#barcode4","AAAA",{width:2,height:18,displayValue:true,fontSize:10});
                    };
                    setInterval(repeat5,5000);   
                    repeat5();
                    </script> -->
					<script language="JavaScript">document.open();Code39(500,100,30,5,"AAAA",2);</script>
                    </td> 
                </tr>              
                  
				<tr>
                    <td rowspan="2" align="center" valign="middle" class="td" style="font-size: 12px;">2</td>
                    
                    <td height="36" valign="top" class="td" style="font-size: 38px;" >
                    <!--<img id="barcode1"/>
                   <!--<script language="JavaScript">           
                    document.open();JsBarcode("#barcode1","1100108682",{width:2,height:18, displayValue:true,fontSize:10});                   
                    </script>--> 
					<!--<script language="JavaScript">document.open();Code39(500,100,30,5,"1100108682",1);</script>-->
                  <img id ="barcode">  		  
					<script language="JavaScript">  
					function  repeat(obj,str_barcode)
						{
							JsBarcode(obj,str_barcode,{width:2,height:20,displayValue:true,fontSize:10});
						}
                    	document.open();repeat("#barcode","1100108682");  
                    </script>  
				   </td> 					
                    <td class="td" style="font-size: 12px;">22225FA</td>
                    <td class="td" style="font-size: 12px;">MT513178A</td>
                    <td class="td" align="center" style="font-size: 12px;">7.000</td>
                    <td class="td" align="center" style="font-size: 12px;">07/03/2018</td>
                    <td class="td" align="center" style="font-size: 12px;">26/04/2018</td>    
                    
                  	<td height="36" valign="top" class="td" style="font-size: 38px;" >
					
                    <!--<img id="barcode2"/>
									
                    <script>
                    var repeat5 = function()
					{
						
                    JsBarcode("#barcode2","7",{width:2,height:18,displayValue:true,fontSize:10});
                    };
                    setInterval(repeat5,5000);   
                    repeat5();
                    </script>  -->
					<script language="JavaScript">document.open();Code39(500,100,30,5,"7",2);</script>
                    </td>   
                    
                </tr>               
                <tr>
                    <td height="36" valign="top" class="td" style="font-size: 38px;" >
                   <!-- <img id="barcode3"/>
                    <script>
                    var repeat5 = function(){
                    JsBarcode("#barcode3","320",{width:2,height:18,displayValue:true,fontSize:10});
                    };
                    setInterval(repeat5,5000);   
                    repeat5();
                    </script>  -->
                        <script language="JavaScript">document.open();Code39(500,100,30,5,"320",2);</script>					
                    </td> 
                    <td colspan="3" class="td" style="font-size: 12px;">BOSS M3 OD4 H5.8[SL400/600G(WELD)]</td>
                    <td colspan="2" class="td" style="font-size: 12px;">2</td>
                    <td height="36" valign="top" class="td" style="font-size: 38px;" >
                    <!--<img id="barcode4"/>
                    <script>
                    var repeat5 = function(){
                    JsBarcode("#barcode4","TTTT",{width:2,height:18,displayValue:true,fontSize:10});
                    };
                    setInterval(repeat5,5000);   
                    repeat5();
                    </script> -->
					<script language="JavaScript">document.open();Code39(500,100,30,5,"TTTT",2);</script>
                    </td> 
                </tr>              
                  
				<tr>
                    <td rowspan="2" align="center" valign="middle" class="td" style="font-size: 12px;">3</td>
                    
                    <td height="36" valign="top" class="td" style="font-size: 38px;" >
                    <!--<img id="barcode1"/>
                   <!--<script language="JavaScript">           
                    document.open();JsBarcode("#barcode1","1100114066",{width:2,height:18, displayValue:true,fontSize:10});                   
                    </script>--> 
					<!--<script language="JavaScript">document.open();Code39(500,100,30,5,"1100114066",1);</script>-->
                  <img id ="barcode">  		  
					<script language="JavaScript">  
					function  repeat(obj,str_barcode)
						{
							JsBarcode(obj,str_barcode,{width:2,height:20,displayValue:true,fontSize:10});
						}
                    	document.open();repeat("#barcode","1100114066");  
                    </script>  
				   </td> 					
                    <td class="td" style="font-size: 12px;">HA4195B</td>
                    <td class="td" style="font-size: 12px;">FY501709B=</td>
                    <td class="td" align="center" style="font-size: 12px;">14.000</td>
                    <td class="td" align="center" style="font-size: 12px;">20/04/2018</td>
                    <td class="td" align="center" style="font-size: 12px;">26/04/2018</td>    
                    
                  	<td height="36" valign="top" class="td" style="font-size: 38px;" >
					
                    <!--<img id="barcode2"/>
									
                    <script>
                    var repeat5 = function()
					{
						
                    JsBarcode("#barcode2","1",{width:2,height:18,displayValue:true,fontSize:10});
                    };
                    setInterval(repeat5,5000);   
                    repeat5();
                    </script>  -->
					<script language="JavaScript">document.open();Code39(500,100,30,5,"1",2);</script>
                    </td>   
                    
                </tr>               
                <tr>
                    <td height="36" valign="top" class="td" style="font-size: 38px;" >
                   <!-- <img id="barcode3"/>
                    <script>
                    var repeat5 = function(){
                    JsBarcode("#barcode3","20",{width:2,height:18,displayValue:true,fontSize:10});
                    };
                    setInterval(repeat5,5000);   
                    repeat5();
                    </script>  -->
                        <script language="JavaScript">document.open();Code39(500,100,30,5,"20",2);</script>					
                    </td> 
                    <td colspan="3" class="td" style="font-size: 12px;">ARM SEAL[SL400/600Q]</td>
                    <td colspan="2" class="td" style="font-size: 12px;">3</td>
                    <td height="36" valign="top" class="td" style="font-size: 38px;" >
                    <!--<img id="barcode4"/>
                    <script>
                    var repeat5 = function(){
                    JsBarcode("#barcode4","TEST1",{width:2,height:18,displayValue:true,fontSize:10});
                    };
                    setInterval(repeat5,5000);   
                    repeat5();
                    </script> -->
					<script language="JavaScript">document.open();Code39(500,100,30,5,"TEST1",2);</script>
                    </td> 
                </tr>              
                  
				<tr>
                    <td rowspan="2" align="center" valign="middle" class="td" style="font-size: 12px;">4</td>
                    
                    <td height="36" valign="top" class="td" style="font-size: 38px;" >
                    <!--<img id="barcode1"/>
                   <!--<script language="JavaScript">           
                    document.open();JsBarcode("#barcode1","1100114066",{width:2,height:18, displayValue:true,fontSize:10});                   
                    </script>--> 
					<!--<script language="JavaScript">document.open();Code39(500,100,30,5,"1100114066",1);</script>-->
                  <img id ="barcode">  		  
					<script language="JavaScript">  
					function  repeat(obj,str_barcode)
						{
							JsBarcode(obj,str_barcode,{width:2,height:20,displayValue:true,fontSize:10});
						}
                    	document.open();repeat("#barcode","1100114066");  
                    </script>  
				   </td> 					
                    <td class="td" style="font-size: 12px;">J26906B</td>
                    <td class="td" style="font-size: 12px;">MW503736B</td>
                    <td class="td" align="center" style="font-size: 12px;">18.000</td>
                    <td class="td" align="center" style="font-size: 12px;">20/04/2018</td>
                    <td class="td" align="center" style="font-size: 12px;">26/04/2018</td>    
                    
                  	<td height="36" valign="top" class="td" style="font-size: 38px;" >
					
                    <!--<img id="barcode2"/>
									
                    <script>
                    var repeat5 = function()
					{
						
                    JsBarcode("#barcode2","1",{width:2,height:18,displayValue:true,fontSize:10});
                    };
                    setInterval(repeat5,5000);   
                    repeat5();
                    </script>  -->
					<script language="JavaScript">document.open();Code39(500,100,30,5,"1",2);</script>
                    </td>   
                    
                </tr>               
                <tr>
                    <td height="36" valign="top" class="td" style="font-size: 38px;" >
                   <!-- <img id="barcode3"/>
                    <script>
                    var repeat5 = function(){
                    JsBarcode("#barcode3","10",{width:2,height:18,displayValue:true,fontSize:10});
                    };
                    setInterval(repeat5,5000);   
                    repeat5();
                    </script>  -->
                        <script language="JavaScript">document.open();Code39(500,100,30,5,"10",2);</script>					
                    </td> 
                    <td colspan="3" class="td" style="font-size: 12px;">DIES TOOL G[LOWER GUIDE DIES G]</td>
                    <td colspan="2" class="td" style="font-size: 12px;">4</td>
                    <td height="36" valign="top" class="td" style="font-size: 38px;" >
                    <!--<img id="barcode4"/>
                    <script>
                    var repeat5 = function(){
                    JsBarcode("#barcode4","TEST2",{width:2,height:18,displayValue:true,fontSize:10});
                    };
                    setInterval(repeat5,5000);   
                    repeat5();
                    </script> -->
					<script language="JavaScript">document.open();Code39(500,100,30,5,"TEST2",2);</script>
                    </td> 
                </tr>              
              
            </table>          
                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-05-10 19:11:52 | 
                        By :
                            owenback | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 Code (JavaScript) 
<!-- <img id="barcode3"/>
<script>
  var repeat5 = function(){
    JsBarcode("#barcode3","10",{width:2,height:18,displayValue:true,fontSize:10});
  };
  setInterval(repeat5,5000);  
  repeat5();
</script>  -->
 
 
Code ข้างบน มาร์ค ไม่ใช้ถูกต้องไหม 
 
แต่ถ้าใช้พอเอามาร์คออก 
 
ให้เอา setInterval(repeat5, 5000); ออกซะ 
เพราะ คำสั่ง repeat5 จะทำงาน ทุกๆ 5 วิ 
ซึ่งนั่นมากพอที่จะทำให้ ตัวแปร repeat5 ถูกเปลี่ยน เป็นฟังก์ชั่นสุดท้าย 
 
และให้ดี ก็อ่าน document สำหรับคำสั่ง setInterval setTimeout มาอ่านดูนะครับ ว่ามันทำอะไร                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-05-10 20:32:24 | 
                        By :
                            Chaidhanan | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 และถ้าจะเขียนให้มันใช้งานครั้งเดียว ลองเขียนแบบนี้ดู 
Code (JavaScript) 
<script>
setTimeout(
  ()=>{
    JsBarcode("#barcode2",,"7",{width:2,height:18,displayValue:true,fontSize:10});
  }
, 5000);
</script>
 
 
และถ้า function jsBarcode อยู่ข้างบน ก่อน <body> 
ก็ลองแบบนี้ 
Code (JavaScript) 
<script>
(()=>{JsBarcode("#barcode2",,"7",{width:2,height:18,displayValue:true,fontSize:10}); })();
</script>
                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-05-10 20:44:30 | 
                        By :
                            Chaidhanan | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ขอบคุณครับ เดี๋ยวลองดูตามคำแนะนำครับ                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-05-11 08:19:17 | 
                        By :
                            owenback | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
      		  
	
     | 
   
 
                 |