1, do not rely on other JS class library
Source code Download: Https://github.com/davidshimjs/qrcodejs:
How to use:
Step1: Referencing the next plugin
<script src= "Scripts/qrcode.js" ></script>
Step2:
<script type= "Text/javascript";
$ (function () {
new QRCode (document.getElementById ("code"), {
text: "http://m.lifevc.com/Special/Prolocutor?act= discountcustnamecpn&coupon=%e6%9d%8e%e5%b0%8f%e9%a3%9e867&uid=2170549 ",//two-D code content
width:256,
height:256,
Typenumber:4,
Colordark: "Red",//Barcode color
colorlight: "#fff"//bar code background color
});
</script>
Plugin QRCode method Part of the source code:
QRCode = function (el, voption) {
This._htoption = {
WIDTH:256,
HEIGHT:256,
Typenumber:4,
Colordark: "#000000",
Colorlight: "#ffffff",
Correctlevel:qrerrorcorrectlevel.h
};
if (typeof voption = = = ' String ') {
Voption = {
Text:voption
};
}
Overwrites options
if (voption) {
for (var i in voption) {
This._htoption[i] = Voption[i];
}
}
Create a QR code plugin