JavaScript生成二维码示例

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/hylexus/article/details/70216341

此处简单介绍使用第三方开源的JavaScript项目来用JavaScript创建二维码。

代码使用很简单,此处只记录简单示例。

详情参考:https://github.com/jeromeetienne/jquery-qrcode/

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>user list</title>

<script type="text/javascript" th:src="@{/js/jquery.min.js}"></script>
<script type="text/javascript" th:src="@{/js/jquery.qrcode.min.js}"></script>
</head>
<body>
    <div id="qrcode"></div>
    <script type="text/javascript">
        $(function() {
            $('#qrcode').qrcode({
                width : 300,
                height : 300,
                text : "这是二维码的内容"
            });
        });
    </script>
</body>
</html>

猜你喜欢

转载自blog.csdn.net/hylexus/article/details/70216341