js生成当前页面地址二维码

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>js生成当前页面二维码</title>
	</head>
	<script type='text/javascript' src='http://cdn.staticfile.org/jquery/2.1.1/jquery.min.js'></script>
	<script type="text/javascript" src="http://cdn.staticfile.org/jquery.qrcode/1.0/jquery.qrcode.min.js"></script>
	<body>
		<div id="qrcode"></div>
		<a id="download" download="qrcode.jpg"></a>
		<button id="down">下载</button>
		<script>
			jQuery('#qrcode').qrcode({
				width: 180,//宽
				height: 180,//高
				text: window.location.href
			});
			$("#down").click(function() {
				var canvas = $('#qrcode').find("canvas").get(0);
				var url = canvas.toDataURL('image/jpeg');
				$("#download").attr('href', url).get(0).click();
				return false;
			});
		</script>
	</body>
</html>

 

给TA打赏
共{{data.count}}人
人已打赏
实用教程

有声阅读整合到苹果cmsV10小说

2020-2-3 15:18:11

实用教程

selectPage.js插件扩展为layui调用

2020-2-11 14:34:46

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索