I. Methods of Use
If you need to use the EAN13 barcode plugin as a jquery plugin, you need to introduce jquery and jquery-ean13.min.js files to the page.
<script type= "Text/javascript" src= "Js/jquery.min.js" ></script>
<script type= "Text/javascript" src= "Dist/jquery-ean13.min.js" ></script>
To invoke the EAN13 barcode via JavaScript, you need to introduce the Ean13.min.js file in the page.
<script type= "Text/javascript" src= "Dist/ean13.min.js" ></script>
Second, HTML structure
Making a EAN13 barcode requires adding a <canvas> element to the page.
<canvas id= "EAN" width= "height=" ></canvas>
If you want to change the size of the EAN13 barcode, just set the width and height of the <canvas> element.
Third, call the plug-in
The following method displays the most basic EAN13 barcodes without any parameter options:
Javascript:
var element = document.getElementById ("EAN");
New EAN13 (element, "9002236311036");
Jquery:
$ ("#EAN"). EAN13 ("9002236311036");
Four, configuration parameters
The EAN13 Barcode plugin provides some configuration parameters and callback functions that you can use to provide a single Parameter object in the second parameter when initializing the plug-in. For example:
Javascript:
var options={
Number:false,
Prefix:false,
Onsuccess:function () {
}
}
New EAN13 (document.getElementById ("EAN"), "9002236311036", options);
Jquery:
$ ("#EAN"). EAN13 ("9002236311036", {
Number:false,
Prefix:false
});
Keymob Mobile advertising platform, professional for developers to provide a stable advertising SDK, including video, interstitial, full screen and so on display mode. It also provides developers with professional services and advertising solutions that allow developers to make greater profits.
HTML5 Adding a canvas EAN13 barcode generation Plugin Tutorial