<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