qrcodejs实现二维码动态生成

测试代码:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <!--二维码生成插件-->
    <script type="text/javascript" src="qrcode/qrcode.min.js"></script>
<body>
<div id="qrcode" style="width:200px; height:200px; margin-top:15px;margin: 0 auto;">
</body>
<script type="text/javascript">

    //初始化二维码参数
    var qrcode = new QRCode(document.getElementById("qrcode"), {
        width : 200,
        height : 200
    });
    (function () {
        qrcode.makeCode("http://www.baidu.com");
    })();

</script>
</html>

  

测试结果:

参考资料:

https://github.com/davidshimjs/qrcodejs

作者:onlystrive

出处:http://www.cnblogs.com/zyuc/

本文版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接。

猜你喜欢

转载自www.cnblogs.com/zyuc/p/9212776.html