标签:
1、不依赖于其他js类库
源代码下载:https://github.com/davidshimjs/qrcodejs:
使用方法:
step1:引用下插件
<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", //二维码内容
width: 256,
height: 256,
typeNumber: 4,
colorDark: "red", //条码的颜色
colorLight: "#fff" //条码背景色
});
});
</script>
//插件QRCode方法部分源码:
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];
}
}
标签:
原文地址:http://www.cnblogs.com/lxf1117/p/4701921.html