js基于qrcode.js生成二维码的方法【附demo插件源码下载】
本文实例讲述了js基于qrcode.js生成二维码的方法。分享给大家供大家参考,具体如下:
调用qrcode.js文件代码:
<!DOCTYPE html> <html> <head> <title></title> <meta charset="utf-8"/> <script src="js/qrcode.js"></script> <style> #qrcode{ /*text-align: center;*/ /*display: table-cell;*/ /*width: 96px;*/ /*height: 96px;*/ /*vertical-align:middle;*/ /*position: relative;*/ } </style> </head> <body> <div> </div> <input type="text"/> <button>点击更换验证码</button> <script> window.onload =function(){ var qrcode = new QRCode(document.getElementById("qrcode"), { width : 96,//设置宽高 height : 96 }); qrcode.makeCode("http://www.haoshilao.net"); document.getElementById("send").onclick =function(){ qrcode.makeCode(document.getElementById("getval").value); } } </script> </body> </html>其中 调用方法:
var qrcode = new QRCode(elem, { width : 96,//设置宽高 height : 96 }); qrcode.makeCode("http://www.haoshilao.net");
《js基于qrcode.js生成二维码的方法【附demo插件源码下载】》阅读地址:http://www.haoshilao.net/15338/
已有0条评论,点击查看发表评论