生成二维码

//测试地址

// http://39.106.12.24/CreateQRCode

<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8"/>
<script src="qrcode.js"></script>//百度搜索自己下
<style>
#qrcode{
text-align: center;
display: table-cell;
96px;
height: 96px;
vertical-align:middle;
position: relative;
}
</style>
</head>
<body>
<div id="qrcode">
</div>

<input type="text" id="getval"/> <button id="send">click!~</button>
<script>
window.onload =function(){
var qrcode = new QRCode(document.getElementById("qrcode"), {
width : 96,//设置宽高
height : 96
});
qrcode.makeCode("http://www.baidu.com");
document.getElementById("send").onclick =function(){
qrcode.makeCode(document.getElementById("getval").value);
}
}


</script>
</body>
</html>

原文地址:https://www.cnblogs.com/ptisagoodman/p/7798652.html