qrcode创建二维码图片

1、引入jquery.min.js和qrcode.js
2、声明创建二维码的容器的DIV
3、调用qrcode.js创建方法

<!DOCTYPE html>
<html>
	<head>
		<title>预览</title>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">
		<script src="../../js/jquery.min.js"></script>
		<script src="../../js/qrcode.js"></script> 
		<style type="text/css">
			body {
				background: #fff;
				margin: 0px;
				padding: 0px;
			}
			h2{
				text-align: center;
			}
			p{
				font-size: 15px;
				font-family: "微软雅黑";
			}
		</style>
		
	</head>
	<body>

		<div id="qrcode" style="margin-left: 30px;"></div> 

	
	</body>
<script type="text/javascript">
var shareUrl='123456789';

var qrcode = new QRCode(document.getElementById("qrcode"), {
	width : 100,
	height : 100
});
function makeCode () {		
	qrcode.makeCode(shareUrl);
}
makeCode();
</script>
</html>

创建QRCode中可传构造参数:
width : 256, //宽度
height : 256,//高度
typeNumber : 4,//计算模式 ,一般不用
colorDark : “#000000”,//图点色
colorLight : “#ffffff”,//背景色
correctLevel : QRErrorCorrectLevel.H//错误级别[L|M|Q|H]

附件地址:
JQuery

qrcode

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值