js动态生成二维码图片

时间:2023-03-09 17:36:16
js动态生成二维码图片

1.html代码

<div id="qrcode" style="width:200px; height:200px;position: fixed;bottom: 40%; right: 20%;"></div>

2.引入外部js文件

<script src="QRCode.js"></script>

3.方法调用

var qrcode = new QRCode(document.getElementById("qrcode"), {
width : 200,
height : 200
});
var token='params';
var QRCodeUrl='http:\\www.baidu.com'+'/Share/ScanQRCode?token='+token;
qrcode.makeCode(QRCodeUrl);

4.QRCode.js文件

下载地址:http://files.cnblogs.com/files/weishuanbao/QRCode.js