<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ko" lang="ko">
<head>
<title>生成二维码测试</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no" />
<script type="text/javascript" src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script type="text/javascript" src="http://code.ciaoca.com/javascript/qrcode/demo/js/qrcode.js"></script>
</head>
<body>
<input id="text" type="text" value="" style="width:300px;height:32px;line-height: 32px;" /><br />
<button id="reduceQrcode" style="height:32px;line-height: 32px;margin-top: 15px;">生成二维码</button>
<div id="qrcode" style="width:100px; height:100px; margin-top:15px;"></div>
</body>
<script type="text/javascript">
var qrcode = new QRCode(document.getElementById("qrcode"), {
text: 'your content',
width: 256, //图像宽度
height: 256, //图像高度
colorDark : '#000000', //前景色
colorLight : '#ffffff', //背景色
correctLevel : QRCode.CorrectLevel.H
});
$("#reduceQrcode").click(function(){
qrcode.makeCode($("#text").val());
})
</script>
</html>
JS生成二维码
最新推荐文章于 2024-04-28 15:21:07 发布