1)query.barcode.js installation
As with other jquery plugins, you only need to import the jquery framework and jquery.barcode.js into the page.
<type= "Text/javascript" src= "Jquery-1.3.2.min.js"> </script><type= "Text/javascript" src = "Jquery-barcode.js" ></ Script >
2)How to use Jquery.barcode.js
2.1) Define a DOM object as a container for barcode/two-D code
<id= "Bctarget"></div>
2.2) use JavaScript to call Jquery.barcode.js to draw barcodes/two-D codes
$ ("#bcTarget"). Barcode ("1234567890128", "ean13");
jquery Object extension Method Barcode parameter Description
barcode:function (datas, type, settings)
2 types of 1.datas parameters supported
- String : The content of the barcode string to draw (depending on the type of barcode). If the barcode type can hold these characters, and there is no validation that is mandatory, the ISE of the string will be automatically calculated (original: If barcode type include it, the presence of the checksum is not mandatory, it Ise automatically recalculated)
- Object
2.type (String): barcode Type
- Codabar
- CODE11 (Code 11)
- Code39 (Code 39)
- Code93 (Code 93)
- CODE128 (Code 128)
- EAN8 (EAN 8)
- Ean13 (EAN 13)
- STD25 (standard 2 of 5-industrial 2 of 5)
- Int25 (Interleaved 2 of 5)
- Msi
- Datamatrix (ASCII + Extended)
3.settings (object): barcode-style configuration
BarWidth (bar code), Barheight (container height), Showhri (whether barcode content is displayed), BgColor (background color), color (barcode color), fontSize (content font size), output (how to draw barcodes: CSS , Svg,bmp,canvas, note that Svg,bmp,canvas does not support IE, preferably not. )
Sample Code
<inputtype= "button"onclick= ' $ ("#bcTarget"). Barcode ("1234567890128","Ean13", {barwidth:2, barheight:30}); ' Value= "Ean13"><inputtype= "button"onclick= ' $ ("#bcTarget2"). Barcode ("1234567","Int25", {barwidth:2, barheight:30}); ' Value= "Int25"> <inputtype= "button"onclick= ' $ ("#bcTarget3"). Barcode ({code:"1234567", Crc:false}, "Int25", {barwidth:2, barheight:30}); ' Value= "Int25 without CRC">
JQUERY Plugin:barcode Barcode Plugin