1.脚本引用
1 | <script type="text/javascript" src="./QRCode_files/qrcode.min.js"></script> |
2.使用方法
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | <script type="text/javascript"> //二维码内容 var txtContent = document.getElementById("txtContent"), tips = document.getElementById("tips"); // 设置 qrcode 参数 var qrcode = new QRCode('qrcode', { text: '请输入二维码内容再生成图像', width: 256, height: 256, colorDark: '#000000', colorLight: '#ffffff', correctLevel: QRCode.CorrectLevel.H }); //生成二维码图像 function f_onCreateQrcode() { if (!txtContent) { return false; } else { if (!txtContent.value) { tips.innerHTML = "!请填写<strong>二维码内容</strong>再提交生成"; } else { // 使用 API qrcode.clear(); tips.innerHTML = ""; qrcode.makeCode(txtContent.value); } return false; } } //清除二维码内容 function f_onClearQrcode() { if (txtContent) { txtContent.value = ""; // 使用 API qrcode.clear(); qrcode.makeCode('请输入二维码内容再生成图像'); } }</script> |
特别申明:
本站所有资源都是由网友投稿发布,或转载各大下载站,请自行检测软件的完整性!
本站所有资源仅供学习与参考,请勿用于商业用途,否则产生的一切后果将由您自己承担!
如有侵权请联系我们删除下架,联系方式:lei1294551502@163.com