前端自动生成条码码插件-JsBarcode.all.min.js
<!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文件:点我下载
滴水成冰,世间不存在毫无意义的付出,时间终会给你答案。