js条形码生成

效果图
在这里插入图片描述

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
    <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
    <script src="JsBarcode.all.min.js"></script>
</head>
<body>
    <div style="width:100%;">
        <table style="width: 800px; border-collapse: collapse; margin: 0px auto;margin-top:100px;" border="1" cellspacing="0" cellpadding="0">
            <tr style="background-image: linear-gradient(to right,#fff,#267cb7) ">
                <td colspan="4" style="height:100px;border:none">
                    <div style="text-align: center; height: 100px;line-height:100px; font-size:28px;">固定资产卡片</div>
                </td>
            </tr>
            <tr>
                <th style="width: 150px; line-height: 40px; height: 40px; text-align: right;"><span style="margin-right: 20px;">资产编号</span></th>
                <td style="text-align: left;"><span style="margin-left: 20px;">ZCSG-202108180001</span></td>
                <th style="width: 150px;text-align: right; "><span style="margin-right: 20px;">资产名称</span></th>
                <td style="text-align: left;"><span style="margin-left: 20px;">红木办公桌</span></td>
            </tr>
            <tr>
                <th style="width: 150px; line-height: 40px; height: 40px; text-align: right; "><span style="margin-right: 20px;">使用部门</span></th>
                <td style="text-align: left;"><span style="margin-left: 20px;">财务部</span></td>
                <th style="width: 150px; text-align: right; "><span style="margin-right: 20px; letter-spacing: 5.2px;">责任人</span></th>
                <td style="text-align: left;"><span style="margin-left: 20px;">路人甲</span></td>
            </tr>
            <tr>
                <td style="height: 80px" colspan="4"><img id="imgcode" /></td>
            </tr>
        </table>
    </div>
</body>
</html>
<script>
    //方式1
    //$("#imgcode").JsBarcode("ZCSG-202108180001");

    //方式2.0
    //JsBarcode("#imgcode", "ZCSG-202108180001");

    //方式2.1
    JsBarcode("#imgcode", "ZCSG-202108180001", {
        format: "CODE39",//选择要使用的条形码类型
        width: 3,//设置条之间的宽度
        height: 80,//高度
        displayValue: true,//是否在条形码下方显示文字
        text: " ",//覆盖显示的文本
        fontOptions: "bold italic",//使文字加粗体或变斜体
        font: "fantasy",//设置文本的字体
        textAlign: "left",//设置文本的水平对齐方式
        textPosition: "top",//设置文本的垂直位置
        textMargin: 5,//设置条形码和文本之间的间距
        fontSize: 15,//设置文本的大小
        background: "#000000",//设置条形码的背景
        lineColor: "red",//设置条和文本的颜色。
        margin: 15//设置条形码周围的空白边距
    });
</script>

条形码js下载地址

https://lindell.me/JsBarcode/
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值