c# - I have a code that show the barcode image but it will show only the image once -


i working show bar codes generated , stored in date base. right able bar code number data base , show image in html using code39.js. code billow show image once want show image , download label products.

<div class="panel panel-info "> <div class="panel panel-heading">     bar codes </div> <table class="table table-striped">      <tr>         <th>product name</th>         <th>quantity</th>      </tr>     @foreach (var items in model.barcodeitems)     {         <tr>             <td>                 @for (int = 0; <= @items.quantity;i++ )                 {                 <div id="externalbox" style="width:4in">                     <div id="inputdata">@items.barcode</div>                 </div>                 <br />                 }                </td>             <td>                 @items.name                 @items.quantity             </td>          </tr>      } </table></div> 

<script type="text/javascript">      function get_object(id) {     var object = null;     if (document.layers) {      object = document.layers[id];     } else if (document.all) {      object = document.all[id];     } else if (document.getelementbyid) {      object = document.getelementbyid(id);     }     return object;    }  get_object("inputdata").innerhtml=drawcode39barcode(get_object("inputdata").innerhtml,8);    </script>

you using ids, , must unique. try use class, this:

<div class="externalbox" style="width:4in">     <div class="inputdata">@items.barcode</div> </div> 

and in script:

 $('.inputdata).each(function() {     var code = $(this).html();     $(this).html(drawcode39barcode(code,8));  }); 

if don't want use jquery:

var x = document.getelementsbyclassname("inputdata"); (var = 0; < x.length; i++) {     var code = x[i].innerhtml;     x[i].innerhtml = drawcode39barcode(code,8); } 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -