jquery.qrcode.js生成二维码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="js/jquery.min.js"></script>
<script src="js/jquery.qrcode.min.js"></script>
<script>
// jQuery(function () {
// $("#qrcode").qrcode({
// render: "table", //table方式
// width: 200, //宽度
// height: 200, //高度
// text: "www.codesky.net" //任意内容
// }); // });
function generateQRCode(rendermethod, picwidth, picheight, url) { $("#qrcode").qrcode({
render: rendermethod, //rendermethod, 渲染方式有table方式(IE兼容)和canvas方式
width: picwidth, //宽度
height: picheight, //高度
text: url, //内容 中文utf16to8(url),
typeNumber: -1, //计算模式
correctLevel: 2, //二维码纠错级别
background: "#ffffff", //背景颜色
foreground: "#000000" //二维码颜色 });
}
function init() {
generateQRCode("table", 200, 200, "https://hao.360.cn/");
var margin = ($("#qrcode").height() - $("#codeico").height()) / 2;
$("#codeico").css("margin", margin);
}
//中文编码格式转换
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;
} </script> </script>
<style type="text/css">
#codeico{
position:fixed;
z-index:9999999;
width:30px;
height:30px;
background:url(images/text.png) no-repeat;
}
</style>
</head>
<body onload="init()">
<div id="qrcode">
<div id="codeico"></div>
</div> </body>
</html>
下载js地址:http://www.oschina.net/p/jquery-qrcode-js
jquery.qrcode.js生成二维码的更多相关文章
- 使用jquery.qrcode.js生成二维码
通常生成二维码的方式有两种:第一种是java代码的形式,第二种是通过Js方式. 在这里我做个记录,用js生成二维码,可以在官网下载源码:http://jeromeetienne.github.io/j ...
- 转: jquery.qrcode.js生成二维码插件&转成图片格式
原文地址: https://blog.csdn.net/u011127019/article/details/51226104 1.qrcode其实是通过使用jQuery实现图形渲染,画图,支持can ...
- jquery.qrcode.js生成二维码(前端生成二维码)
官网地址:http://jeromeetienne.github.io/jquery-qrcode/ 第一步引入插件: <script type='text/javascript' src='h ...
- jquery.qrcode.js 生成二维码并支持中文的方法
GitHub地址: https://github.com/jeromeetienne/jquery-qrcode <div class="QR"></div> ...
- QRCode.js生成二维码
QRCode的GitHub地址: https://github.com/KeeeX/qrcodejs 该版本解决了主版本(https://github.com/davidshimjs/qrcodejs ...
- qrcode.js生成二维码因字符串过长而报错
前端使用qrcode.js生成二维码的时候.有时候是会出现 qrcode length overflow (1632>1056) 目前使用的有效的解决办法是重新下载新版的qrcode.js 下载 ...
- 利用vcard和qrcode.js生成二维码导入联系人
vCard是一种容许交换个人信息的数据规范,vCard数据格式的标识符是VCARD,vCard数据格式行是: 类型 [;参数]:值,具体的介绍百度都有,我们可以通过vcard来进行通讯录的保存,名片的 ...
- 【QRcode二维码】:使用JS前端插件QRcode.js生成二维码
1.先简单说一下jquery-qrcode,这个开源的三方库(可以从https://github.com/jeromeetienne/jquery-qrcode 获取), qrcode.js 是实现二 ...
- QRCode.js 生成二维码
QRCode.js 是一个用于生成二维码图片的插件. github地址 在线实例 实例预览 基础示例 实例预览 API 接口 使用方法 载入 JavaScript 文件 <script src= ...
随机推荐
- arp -s 157.55.85.212 00-aa-00-62-c6-09 .... Adds a static entry.
ARp是一个重要的TCp/Ip协议,并且用于确定对应Ip地址的网卡物理地址.实用arp命令,我们能够查看本地计算机或另一台计算机的ARp高速缓存中的当前内容.此外,使用arp命令,也可以用人工方式输入 ...
- Android应用框架浅析
http://blog.csdn.net/yanbober/article/category/3206943 Android应用层View绘制流程与源码分析 http://blog.csdn.ne ...
- 94、EventBus框架 ---- 转载
EventBus使用之基础 http://blog.csdn.net/yanbober/article/details/45667363 EventBus框架库代码走读 http://blog.cs ...
- Nginx 配置指令location 匹配符优先级和安全问题【转】
Nginx配置指令location匹配符优先级和安全问题 使用nginx 很久了,它的性能高,稳定性表现也很好,得到了很多人的认可.特别是它的配置,有点像写程序一样,每行命令结尾一个";&q ...
- python中的enumerate函数
enumerate 函数用于遍历序列中的元素以及它们的下标: >>> for i,j in enumerate(('a','b','c')): print i,j 0 a1 b2 c ...
- 可以获取客户端ip的API
http://www.ip138.com/ip2city.asp http://www.bliao.com/ip.phtml http://www.whereismyip.com/ http://ww ...
- 页面设计--CheckBoxList
CheckBoxList 下拉多选控件 控件属性如下图: 取值设置:多选只能从数据库表中来获取:支持过滤条件设置(支持权限条件值.控件值条件.系统变量值等做为过滤条件) web效果显示:
- (转)adb shell am 的用法
原文地址:http://blog.csdn.net/fulinwsuafcie/article/details/8092459 adb shell am 的功能 adb shell am 使用此命 ...
- Rolling Cursor Invalidations with DBMS_STATS.AUTO_INVALIDATE (文档 ID 557661.1)
Rolling Cursor Invalidations with DBMS_STATS.AUTO_INVALIDATE (文档 ID 557661.1) 转到底部 In this Documen ...
- Android——主流分辨率
VGA:480*640 QVGA:240*320 HVGA:320*480 WVGA:480*800 FWVGA:480*854 IntelHaxm.exe 模拟器加速器
