随着智能手机普及率越来越高,在网站建设中为了给手机客户提供快捷的访问方式,二维码是简单方便的,但如何让自己的内容来自动随机的生成二维码呢?今天绵阳动力网络公司就为大家介绍关于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);