qrcode 生成二维码
qrcode 生成二维码
Demo:
qrcodeGithub 地址:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>qrcode生成二维码</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../plugins/bootstrap-4.1.3-dist/css/bootstrap.min.css">
<script src="../plugins/echarts/jquery.min.js"></script>
<script src="../plugins/bootstrap-4.1.3-dist/js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/jquery.qrcode.min.js"></script>
</head>
<body>
<div class="alert alert-primary" role="alert" style="text-align: center;margin:10px;">
<b>生成的二维码如下:</b>
</div>
<div id="qrCodeDiv" style="text-align: center; margin:40px;">
<img id="qrCodeIco" src="logo.png" style="position: absolute;width: 64px; height: 64px;" />
</div>
</body>
<script type="text/javascript">
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;
};
$("#qrCodeDiv").qrcode({
render: "canvas", //渲染方式有table方式(IE兼容)和canvas方式
width: 260, //宽度
height: 260, //高度
text: utf16to8("https://www.cnblogs.com/hglibin/"), //内容
typeNumber: -1, //计算模式
correctLevel: 2, //二维码纠错级别
background: "#ffffff", //背景颜色
foreground: "#000000" //二维码颜色
});
var margin = ($("#qrCodeDiv").height() - $("#qrCodeIco").height()) / 2; //控制Logo图标的位置
$("#qrCodeIco").css("margin", margin);
</script>
</html>
运行结果:

qrcode 生成二维码的更多相关文章
- C# 利用QRCode生成二维码图片
网上生成二维码的组件是真多,可是真正好用的,并且生成速度很快的没几个,QRCode就是我在众多中找到的,它的生成速度快.但是网上关于它的使用说明,真的太少了,大都是千篇一律的复制粘贴.这是本要用它做了 ...
- Qrcode生成二维码的参数总结 及最小尺寸的测试
Qrcode生成二维码,做过很多实验,探索最小规格的二维码到底是多少尺寸,和最高规格的二维码到底是多大尺寸.现在我总结总结: 有两种思路: 1.生成规格高的二维码,然后压缩到自己想要的尺寸的二维码.这 ...
- 使用jquery.qrcode生成二维码及常见问题解决方案
转载文章 使用jquery.qrcode生成二维码及常见问题解决方案 一.jquery.qrcode.js介 jquery.qrcode.js 是一个纯浏览器 生成 QRcode 的 jQuery ...
- C#Qrcode生成二维码支持中文,带图片,带文字
C#Qrcode生成二维码支持中文带图片的操作请看二楼的帖子,当然开始需要下载一下C#Qrcode的源码 下载地址 : http://www.codeproject.com/Articles/2057 ...
- python_使用qrcode生成二维码
1.功能 使用qrcode生成二维码 2.代码 #生成二维码: import qrcode #根据url生成二维码 def qrcodeWithUrl(url): img = qrcode.make( ...
- 使用jquery.qrcode生成二维码实现微信分享功能
前言: 最近有个这样的需求,在pc端的商品详情页增加分享功能. 微博分享.QQ好友分享.QQ空间分享这些都很常见.但是微信分享我还没有手动写过(以前改过). 最终效果如下图: 解决方案:使用jquer ...
- QRCode生成二维码,jq QRCode生成二维码,QRCode生成电子名片
[QRCode官网]http://phpqrcode.sourceforge.net/ PHP QRCode生成二维码 官网下载QRCode源码包,引入源码包中的 qrlib.php . <?p ...
- 使用jquery.qrcode生成二维码(转)
jQuery 的 qrcode 插件就可以在浏览器端生成二维码图片. 这个插件的使用非常简单: 1.首先在页面中加入jquery库文件和qrcode插件. <script type=" ...
- 使用QRCode生成二维码
第一步: 获取QRCode组件 可以通过vs的nuget管理安装Gma.QrCodeNet, 也可以直接添加"Gma.QrCodeNet.Encoding.dll"的引用. 第二步 ...
随机推荐
- Ubuntu 14.04.3 window10双系统情遇到'Disconnected: You are now offline'问题
笔电是win10系统,单独开除50G做了一个Ubuntu系统,安装的是14.04.03版本,安装成功后,发现wifi连接不上,选择wifi并输入密码后提示:“Disconnected: You are ...
- Python学习笔记(十八)@property
# 请利用@property给一个Screen对象加上width和height属性, # 以及一个只读属性resolution: # -*- coding: utf-8 -*- class Scree ...
- JavaScript arguments你不知道的秘密
(function test(x){ x=10; console.log(arguments[0], x); //undefined, 10 })(); (function test(x){ x=10 ...
- 朋友封装的一个ASP.NET上传文件的方法
朋友做了asp.net开发多年,做了这个,自我感觉封装得还不错!!! 代码如下: #region 上传文件的方法 /// <summary> /// 上传文件方法 /// </sum ...
- HDFS默认副本数为什么是3
转载自: https://www.cnblogs.com/bugchecker/p/why_three_replications_for_HDFS_in_engineer.html HDFS采用一种称 ...
- 【CodeForces】679 B. Bear and Tower of Cubes
[题目]B. Bear and Tower of Cubes [题意]有若干积木体积为1^3,2^3,...k^3,对于一个总体积X要求每次贪心地取<=X的最大积木拼上去(每个只能取一次)最后总 ...
- JQuery的几个基础操作
先介绍两个函数(数组) 1.$.map(array,function(element,index)); 对于数组array中的每个元素,调用上面所示的function(element,index)函数 ...
- Vue 使用自定义组件时报错:Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>'
自己试做了一下vue的插件 参考element-ui: 写了一个组件 import message from './packages/message/index.js'; const install ...
- 导航狗IT周报第十五期(July 8, 2018)
摘要:Seclists.Org: 微信支付SDK存在XXE漏洞:WordPress 4.9.6存在文件删除漏洞:linux中常用的文件打包/解包与压缩/解压缩命令总结… 安全播报 Seclists.O ...
- [001] leap_stage
[Description] There is a number in each stages that indicates the most stages you can leap up. Now, ...