二维码生成器和二维码分享

二维码生成器和二维码分享二维码生成器 varqrcode newQRCode document getElementBy qrcode width 100 height 100 functionmake

大家好,欢迎来到IT知识分享网。

<html>
<head>
	<title>二维码生成器-</title>
</head>
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no" />
<script type="text/javascript" src="http://static.runoob.com/assets/jquery/2.0.3/jquery.min.js"></script>
<script type="text/javascript" src="http://static.runoob.com/assets/qrcode/qrcode.min.js"></script>
<body>
<input id="text" type="text" value="666" style="width:80%" /><br />
<div id="qrcode" style="width:100px; height:100px; margin-top:15px;"></div>

<script type="text/javascript">
var qrcode = new QRCode(document.getElementById("qrcode"), {
	width : 100,
	height : 100
});

function makeCode () {		
	var elText = document.getElementById("text");
	
	if (!elText.value) {
		alert("Input a text");
		elText.focus();
		return;
	}
	
	qrcode.makeCode(elText.value);
}

makeCode();

$("#text").
	on("blur", function () {
		makeCode();
	}).
	on("keydown", function (e) {
		if (e.keyCode == 13) {
			makeCode();
		}
	});
</script>
</body>
</html>

二维码生成器:http://codepen.io/dddddd1/pen/YpXxPX

————————————————二维码分享————————————————–

<!DOCTYPE html>
<html>
<head>
    <title>当前网站生成二维码</title>
    <meta charset="utf-8" />
</head>


<body>
<div id="qrcodeCanvas"></div>
</body>
<script type="text/javascript" src="https://static.runoob.com/assets/jquery/2.0.3/jquery.min.js"></script>
<script src="https://cdn.staticfile.org/jquery.qrcode/1.0/jquery.qrcode.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
    var url = window.location.href;
    console.log(url);
    jQuery('#qrcodeCanvas').qrcode({
        text    : url,
        width : 105,
        height : 105
    });  
})
</script>
</html>

-二维码分享:

https://codepen.io/dddddd1/pen/oGMBPv

扫出来就是当前网址

参考:https://www.helloweba.com/view-blog-226.html


免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://haidsoft.com/113118.html

(0)
上一篇 2026-01-14 10:20
下一篇 2026-01-14 10:33

相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注微信