<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>生成二维码</title>
<script src="js/JsBarcode.all.js"></script>
<script src="js/qrcode.js"></script>
<script>
Number.prototype.zeroPadding = function () {
var ret = "" + this.valueOf();
return ret.length == 1 ? "0" + ret : ret;
};
</script>
</head>
<body>
<!-- 条形码 -->
<div>
<img id="barcode5" style="margin-bottom: 50px;"/>
<script>
var repeat5 = function () {
JsBarcode("#barcode5", "123456789", { displayValue: true, fontSize: 20 });
};
repeat5();
</script>
</div>
<!-- 二维码 -->
<input id="text" type="text" value="http://jindo.dev.naver.com/collie" style="width:80%" /><br />
<div id="qrcode1" style="width:100px; height:100px; margin-top:15px;"></div>
<script src="jquery-1.12.4.min.js"></script>
<script>
var qrcode = new QRCode(document.getElementById("qrcode1"), {
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>
上面用到的js下载路径
也可以加我QQ发给你 643940471