生成二維碼(jquery.qrcode.min.js插件)


生成二維碼:參看GitHub資源https://github.com/jeromeetienne/jquery-qrcode

直接上代碼:(都需要引入jQuery.js  1、引入(jquery.qrcode.min.js)或者引入下邊兩個文件(jquery.qrcode.js和qrcode.js))

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>生成二維碼</title>
        <!--都需要引入jQuery.js文件-->
        <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
        <!--<script type="text/javascript" src="js/qrcode/jquery.qrcode.min.js"></script>-->
            
        <!--引入上邊一個文件(jquery.qrcode.min.js)或者引入下邊兩個文件(jquery.qrcode.js和qrcode.js)-->
        
        <script src="js/qrcode/jquery.qrcode.js"></script>
        <script src="js/qrcode/qrcode.js"></script>
        <style>
        body{
            text-align: center;
        }
        #qrcode{
            margin:100px auto;
        }
        #text{
            width: 400px;height: 200px;
            border:1px solid #ccc;
        }
        </style>
    </head>
    <body>
        <input type="text" id="text" placeholder="請輸入要生成二維碼的文本">
        <input type="button" id="create" value="生成二維碼">
        <br>
        <div id="qrcode"></div>
        <script type="text/javascript">
            $('#create').click(function(){
                    $('#qrcode').html('').qrcode({
                        text: $('#text').val()
                    });
            })
        </script>
    </body>
</html>

 

文件路徑

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM