将url动态转换成二维码插件 - 兼容IE8


插件地址  http://static.runoob.com/assets/qrcode/qrcode.min.js ,网页直接打开,然后ctrl+s保存到本地。

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <button id="btn">分享</button>
        <div id="qrcode" style="display: none;"></div>
        <script src="jquery.min.js"></script>
        <script src="qrcode.min.js"></script>
        <script>
             var qrcode = new QRCode(document.getElementById("qrcode"), {
                width : 200,
                height : 200
            });
            var urlPath = window.location.href;
            qrcode.makeCode(urlPath);
            $("#btn").mouseover(function(){
                $('#qrcode').show();
            }).mouseout(function(){
                $('#qrcode').hide();
            })
            
        </script>
    </body>
</html>

 

效果截图:

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM