前端自動生成條碼碼外掛-JsBarcode.all.min.js
阿新 • • 發佈:2021-11-09
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>js生成條形碼外掛</title> <script src="https://cdn.bootcss.com/jsbarcode/3.8.0/JsBarcode.all.min.js"></script> <style> * {margin: 0;padding: 0;box-sizing: border-box;} h3 {text-align: center;font-size: 16px;margin: 10px;} .box {text-align: center;} #barcode {width: 200px;} </style> </head> <body> <h3>js自動生成條形碼外掛-JsBarcode</h3> <div class="box"> <img id="barcode" /> </div> </body> <script> var barcode = document.getElementById('barcode'), str = "1234567890", options = { format: "CODE128", displayValue: true, fontSize: 18, height: 100 }; JsBarcode(barcode, str, options); //原生 // $('#barcode').JsBarcode(string, options); //jQuery </script> </html>
附本地JS檔案:點我下載
滴水成冰,世間不存在毫無意義的付出,時間終會給你答案。