<%--
Created by IntelliJ IDEA.
User: Administrator
Date: 2017/11/9/009
Time: 16:19
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8"/>
<script src="js/qrcode.js"></script>
<script src="js/jquery.min.js"></script>
<style type="text/css">
#qrcode{
position: relative;
margin-top: 100px;
margin-left:100px;
background: white;
}
</style>
</head>
<body>
<!-- 第一种 -->
<div id="qrcode1"></div>
<script type="text/javascript">
new QRCode(document.getElementById("qrcode1"), "http://www.w3cways.com");
</script>
<!-- 第二种 -->
<div id="qrcode"></div>
<script>
var width = $(window).width()*0.3;
alert(width);
var qrcode = new QRCode(document.getElementById("qrcode"), {
width : width,//设置宽高
height : width,
colorDark: '#000',
colorLight: "#ffffff"
});
qrcode.clear(); // 清除代码.
qrcode.makeCode("http://baidu.com"); // 生成另外一个二维码.
</script>
</body>
</html>
前端生成二维码
最新推荐文章于 2024-08-06 10:38:25 发布