JSFiddle - React, Tailwind, and code Playground
HTML
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="../jquery-barcode.js"></script>
</head>
<body>
<div id="maindiv">
<div id="bcTarget"></div>
</div>
<script type="text/javascript">
$(document).ready(function() {
$("#bcTarget").barcode("94223882491356519711","code128");
});
</script>
</body>
CSS
<style type="text/css">
body {
font-family: "標楷體", serif;
font-size: 14px;
}
#maindiv {
width: 6cm;
height: 9cm;
border: 1px solid #0088dd;
text-align: center;
}
#bcTarget {
margin: 0px auto;
height: 1cm;
width:4.5cm;
}
</style>
JavaScript
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="../jquery-barcode.js"></script>
<script>/*!
* BarCode Coder Library (BCC Library)
* BCCL Version 2.0
*
* Porting : jQuery barcode plugin
* Version : 2.0.3
*
* Date : 2013-01-06
* Author : DEMONTE Jean-Baptiste <jbdemonte@gmail.com>
* HOUREZ Jonathan
*
* Web site: http://barcode-coder.com/
* dual licence : http://www.cecill.info/licences/Licence_CeCILL_V2-fr.html
* http://www.gnu.org/licenses/gpl.html
*/
(function ($) {
var barcode = {
settings:{
barWidth: 1,
barHeight: 50,
moduleSize: 5,
showHRI: true,
addQuietZone: true,
marginHRI: 5,
bgColor: "#FFFFFF",
color: "#000000",
fontSize: 10,
output: "css",
posX: 0,
posY: 0
},
intval: function(val){
var type = typeof( val );
if (type == 'string'){
val = val.replace(/[^0-9-.]/g, "");
val = parseInt(val * 1, 10);
return isNaN(val) || !isFinite(val) ? 0 : val;
}
return type == 'number' && isFinite(val) ? Math.floor(val) : 0;
},
i25: { // std25 int25
encoding: ["NNWWN", "WNNNW", "NWNNW", "WWNNN", "NNWNW", "WNWNN", "NWWNN", "NNNWW", "WNNWN","NWNWN"],
compute: function(code, crc, type){
if (! crc) {
if (code.length % 2 != 0) code = '0' + code;
} else {
if ( (type == "int25") && (code.length % 2 == 0) ) code = '0' + code;
var odd = true, v, sum = 0;
for(var i=code.length-1; i>-1; i--){
v = barcode.intval(code.charAt(i));
if (isNaN(v)) return("");
sum += odd ? 3 * v : v;
odd = ! odd;
}
code += ((10 - sum % 10) % 10).toString();
}
return(code);
},
getDigit: function(code, crc, type){
code = this.compute(code, crc, type);
if (code ==...