jQuery.qrCode.js实现二维码生成
来源:互联网 发布:计数排序java实现 编辑:程序博客网 时间:2024/06/02 17:05
代码如下:
<!DOCTYPE html><html><head><title>basic example</title></head><style type="text/css">*{margin:0;padding:0;font-family:微软雅黑;}#qrcode{border:1px solid #AFAFAF;width:200px;height:200px}</style><body><script src="../jQuery/jquery-1.9.1.min.js" type="text/javascript"></script><script type="text/javascript" src="../jQuery/jquery.qrcode.js"></script><script type="text/javascript" src="../jQuery/qrcode.js"></script><p>Render in canvas</p><div id="qrcode"></div><script>//中文乱码,将UTF-16转换为UTF-8,UTF-16长度为2位,UTF-8为3位String.prototype.toUTF8=function(){var result = ""; //转码后的结果for(var i=0,maxLen=this.length;i<maxLen;i++) {var t = this.charCodeAt(i);if( (t >= 0x0001) && (t <= 0x007F)) {result += this.charAt(i);} else if (t > 0x07FF) { result += String.fromCharCode(0xE0 | ((t >> 12) & 0x0F)); result += String.fromCharCode(0x80 | ((t >> 6) & 0x3F)); result += String.fromCharCode(0x80 | ((t >> 0) & 0x3F)); } else { result += String.fromCharCode(0xC0 | ((t >> 6) & 0x1F)); result += String.fromCharCode(0x80 | ((t >> 0) & 0x3F)); } }return result;}jQuery('#qrcode').qrcode({render : "canvas" , //渲染方式:还可以为table方式width : 200, //生成二维码的宽度height : 200, //生成二维码的高度typeNumber : -1, //计算方式correctLevel : QRErrorCorrectLevel.H,//纠错等级background : "#FFFFFF", //背景色foreground : "#3399CC", //前景色text: "许增强".toUTF8() //会乱码});</script></body></html>
0 0
- jQuery.qrCode.js实现二维码生成
- 生成二维码jQuery 插件jquery.qrcode.js
- 如何使用 jQuery.qrcode.js 生成二维码
- 使用 jquery.qrcode.js生成二维码
- jquery.qrcode.min.js生成二维码插件
- 使用jquery.qrcode.js生成二维码
- 使用jquery.qrcode.js 生成二维码
- 使用jquery.qrcode.js生成二维码
- jquery.qrcode.js 动态生成二维码插件
- JS生成二维码 jquery.qrcode 插件
- jquery.qrcode生成二维码
- jquery.qrcode生成二维码
- jquery-qrcode生成二维码
- jquery.qrcode 生成二维码
- jquery-QRCode生成二维码
- jQuery.qrcode生成二维码
- qrcode.js生成二维码
- QRCode.js 生成二维码
- R_X86_64_32 & could not read symbols: Bad value编译
- awk命令详解
- 几个系统调用分析 glibc中的malloc调用和共享内存原理
- Cannot create a server using the selected type
- iOS开发~CocoaPods使用详细说明
- jQuery.qrCode.js实现二维码生成
- IOS7开发~UDID解决方法
- 关于cocos2dx中文转UTF8码的解决方案
- Rotate List
- 文件头
- C#多线程编程总结
- IOS高级开发~开机启动&无限后台运行&监听进程
- hashmap与hashtable的区别,以及实现hashmap的同步操作
- 使用ngrok快速地将本地Web服务映射到外网