<!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;}
ul {padding: 5px;}
li {list-style: none;padding: 5px 10px;font-size: 14px;line-height: 18px;}
pre {font-size: 12px;}
</style>
</head> <body>
<h3>js自动生成条形码插件-JsBarcode</h3>
<div class="box">
<img id="barcode" />
</div>
<ul>
<li>npm官网地址:https://www.npmjs.com/package/jsbarcode</li>
<li>github:https://github.com/lindell/JsBarcode</li>
<li>使用说明:</li>
<li>引入JsBarcode插件:JsBarcode.all.min.js</li>
<li>可以访问:http://www.bootcdn.cn/jsbarcode/</li>
<li>在HTML中放置img标签存放条形码的容器</li>
<li>默认配置项</li>
<li>
<pre>
{
width: 2,//较细处条形码的宽度
height: 100, //条形码的宽度,无高度直接设置项,由位数决定
//也可以通过CSS去调整
quite: 10,
format: "CODE128",
displayValue: false,//是否在条形码下方显示文字
font:"monospace",
textAlign:"center",
fontSize: 12,
background:"",
lineColor:"#000"//条形码颜色
}
</pre>
</li>
</ul>
</body>
<script>
var barcode = document.getElementById('barcode'),
str = "18612908099",
options = {
format: "CODE128",
displayValue: true,
fontSize: 18,
height: 100
};
JsBarcode(barcode, str, options); //原生
// $('#barcode').JsBarcode(string, options); //jQuery
</script> </html>

js生成条形码插件的更多相关文章

  1. js自动生成条形码插件-JsBarcode

    JsBarcode.html <!DOCTYPE html> <html lang="en"> <head> <meta charset= ...

  2. 使用js生成条形码以及二维码

    一.用js生成条形码这种业务场景不是很常见的,最近刚好又接到这种需求 Google一下,发现github还真有这方面的轮子,感谢github,省去了我们很多造轮子的过程, 好了言归正传,首先引入jsb ...

  3. 生成条形码插件 条形码--JsBarcode

    每天学习一点点 编程PDF电子书免费下载: http://www.shitanlife.com/code 介绍一下在GitHub生成条形码的js插件→JsBarcode 条码支持的有: CODE128 ...

  4. js生成条形码——JsBarcode

    原文地址:https://www.cnblogs.com/huangenai/p/6347607.html 介绍一下在GitHub生成条形码的js插件→JsBarcode 条码支持的有: CODE12 ...

  5. js生成条形码

    生成条形码 <body> <div> <img id="ma"/> </div> </body> </html&g ...

  6. Barcode.js功能强大的条码生成jQuery插件

    本文转载自http://www.uedsc.com/barcode-js.html Barcode.js是一个基于jQuery库的插件,用于绘制条形码或者二维码,能够生成基于DIV+CSS或者Canv ...

  7. 使用js生成二维码和条形码

    1.生成二维码 使用github开源项目qrcode. 1.引入方式一(js cdn引入): ①.引入qrcode cdn: 自行下载..没有合适的cdn,地址 <script src=&quo ...

  8. js插件---在线类似excel生成图表插件解决方案

    js插件---在线类似excel生成图表插件解决方案 一.总结 一句话总结:google比百度好用多了,多用google google js editable table jquery 双向绑定 这种 ...

  9. 前端如何生成条形码---JsBarcode

    React 生成条形码代码 注:需引入 jsbarcode 插件 import React from 'react'; import JsBarcode from 'jsbarcode'; class ...

随机推荐

  1. jackson java对象和json对象的互相转换

    概述 Jackson框架是基于Java平台的一套数据处理工具,被称为“最好的Java Json解析器”. Jackson框架包含了3个核心库:streaming,databind,annotation ...

  2. Codeforces Beta Round #79 (Div. 2 Only)

    Codeforces Beta Round #79 (Div. 2 Only) http://codeforces.com/contest/102 A #include<bits/stdc++. ...

  3. AltiumDesigner 网络标号放置技巧

    我们在使用AD画图的过程中,灵活的使用一些小技巧可以使我们的工作事半功倍,今天给大家介绍一种在画原理图过程中的小技巧. 我们在画原理图过程中经常会放置网络标号,尤其是很多芯片管脚上,例如现在我需要在这 ...

  4. 联机分析处理ROLAP、MOLAP和HOLAP区别(转)

    OLAP(on-Line Analysis Processing)是使分析人员.管理人员或执行人员能够从多角度对信息进行快速.一致.交互地存取,从而获得对数据的更深入了解的一类软件技术.OLAP的目标 ...

  5. 775. Global and Local Inversions局部取反和全局取反

    [抄题]: We have some permutation A of [0, 1, ..., N - 1], where N is the length of A. The number of (g ...

  6. [z]分区truncate操作的介绍及对全局索引和空间释放影响的案例解析

    [z]https://www.2cto.com/database/201301/181226.html 环境: [sql] [oracle@localhost ~]$ uname -r 2.6.18- ...

  7. bootstrap collapse 无法收回

    $(function () { //修复collapse不能正常折叠的问题 $(".collapsed").click(function () { var itemHref = $ ...

  8. andorid 配置器组件和提示消息

    .xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android ...

  9. 839A Arya and Bran

    A. Arya and Bran time limit per test 1 second memory limit per test 256 megabytes input standard inp ...

  10. de4dot破解脱壳新版MaxtoCode源数组长度不足解决办法

    之前在看雪混了4年.NET破解版主,现在转战这里,发现很多人还在玩的是工具类的破解,可以说这里的人都还是皮毛啊 最近很多人问使用de4dot脱壳MaxtoCode有问题,之前写过一个教程,那是工具篇的 ...