index.html 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <!DOCTYPE HTML>
  2. <html lang="en-US">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title></title>
  6. <script src="../dist/JsBarcode.all.js"></script>
  7. <script>
  8. Number.prototype.zeroPadding = function(){
  9. var ret = "" + this.valueOf();
  10. return ret.length == 1 ? "0" + ret : ret;
  11. };
  12. </script>
  13. </head>
  14. <body>
  15. <div>
  16. <img id="barcode1"/>
  17. <script>JsBarcode("#barcode1", "Hi!");</script>
  18. </div>
  19. <div>
  20. <img id="barcode2"/>
  21. <script>
  22. JsBarcode("#barcode2", "9780199532179", {
  23. format:"EAN13",
  24. displayValue:true,
  25. fontSize:24,
  26. lineColor: "#0cc"
  27. });
  28. </script>
  29. </div>
  30. <div>
  31. <img id="barcode3"/>
  32. <script>JsBarcode("#barcode3", "9780199532179", {
  33. format:"EAN13",
  34. displayValue:true,
  35. fontSize:20
  36. });</script>
  37. </div>
  38. <div>
  39. <img id="barcode4"/>
  40. <script>
  41. var repeat4 = function(){
  42. var date = new Date();
  43. JsBarcode("#barcode4",
  44. date.getHours().zeroPadding() + ":" +
  45. date.getMinutes().zeroPadding() + ":" +
  46. date.getSeconds().zeroPadding(),
  47. {displayValue: true});
  48. };
  49. setInterval(repeat4,1000);
  50. repeat4();
  51. </script>
  52. </div>
  53. <div>
  54. <img id="barcode5"/>
  55. <script>
  56. var repeat5 = function(){
  57. JsBarcode("#barcode5", Math.floor(1000000+Math.random()*9000000)+"",{displayValue:true,fontSize:20});
  58. };
  59. setInterval(repeat5,500);
  60. repeat5();
  61. </script>
  62. </div>
  63. </body>
  64. </html>