首页 / 二维码 / qrcode网页生成二维码
qrcode网页生成二维码
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了qrcode网页生成二维码,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1580字,纯文字阅读大概需要3分钟。
内容图文
![qrcode网页生成二维码](/upload/InfoBanner/zyjiaocheng/1290/20d65276ce8644f8b4638e8b9f05a288.jpg)
jquery.qrcode.js
http://blog.jetienne.com/blog/2011/04/07/jquery-qrcode/
介绍:
jquery.qrcode.js is jquery plugin for a pure browser qrcode generation. It allow you to easily add qrcode to your webpages.
使用:
How to Use It
Let me walk you thru it. First include it in your webpage with the usual script tag
<script type="text/javascript" src="jquery.qrcode.min.js"></script>
Then create a DOM element which gonna contains the generated qrcode image. Lets say a div
<div ></div>
Then you add the qrcode in this container by
jquery(‘#qrcode‘).qrcode("this plugin is great");
详细使用:
$("#code").qrcode({
render: "canvas", //table方式
width: 200, //宽度
height:200, //高度
typeNumber: -1, //计算模式
//correctLevel: QRErrorCorrectLevel.H,//纠错等级
background: "#ffffff",//背景颜色
foreground: "#000000", //前景颜色
// text: utf16to8("钓鱼岛是中国的!") //任意内容
text:"http://www.baidu.com"
});
要支持中文,需转码:
function utf16to8(str) {
var out, i, len, c;
out = "";
len = str.length;
for(i = 0; i < len; i++) {
c = str.charCodeAt(i);
if ((c >= 0x0001) && (c <= 0x007F)) {
out += str.charAt(i);
} else if (c > 0x07FF) {
out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));
out += String.fromCharCode(0x80 | ((c >> 6) & 0x3F));
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
} else {
out += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F));
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
}
}
return out;
}
下载:
https://github.com/jeromeetienne/jquery-qrcode
原文:http://www.cnblogs.com/wildorchid/p/4703973.html
内容总结
以上是互联网集市为您收集整理的qrcode网页生成二维码全部内容,希望文章能够帮你解决qrcode网页生成二维码所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。