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


一、下載

鏈接:https://pan.baidu.com/s/1cMjaCYQ_buZNT5XRRjuNTA
提取碼:myqm 

二、效果圖

 

 三、代碼

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        #qrcode {
            width:160px;
            height:160px;
            margin-top:15px;
        }
    </style>
</head>
<body>
<input id="text" type="text" value="http://www.test.com" /><br />
<div id="qrcode"></div>
<script src="./jquery.js"></script>
<script src="./jquery.qrcode.min.js"></script>
<script>

    function makeCode () {
        var elText = document.getElementById("text");

        if (!elText.value) {
            alert("Input a text");
            elText.focus();
            return;
        }
        $("#qrcode").qrcode(elText.value);
    }

    makeCode();

    $("#text").
    on("blur", function () {
        makeCode();
    }).
    on("keydown", function (e) {
        if (e.keyCode == 13) {
            makeCode();
        }
    });
</script>
</body>
</html>

 


免責聲明!

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



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