日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

利用jquery的qrcode.js插件生成二维码的两种方式的使用

發布時間:2024/9/21 编程问答 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 利用jquery的qrcode.js插件生成二维码的两种方式的使用 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

2019獨角獸企業重金招聘Python工程師標準>>>

利用jquery的qrcode.js插件生成二維碼的額兩種方式,canvas(即畫布)方式和table方式(原文地址http://www.helloweba.com/view-blog-226.html):

默認打開時是canvas生成。

當點擊時是table生成。

query_qrcode.html

<!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <title>演示:使用jquery.qrcode生成二維碼</title> <link rel="stylesheet" type="text/css" href="../css/main.css" /> <style type="text/css"> .demo{width:400px; margin:40px auto 0 auto; min-height:250px;} .demo p{line-height:30px} #code{margin-top:10px} </style> <script type="text/javascript" src="jquery-1.11.3.min.js"></script> <script type="text/javascript" src="jquery.qrcode.min.js"></script> <script type="text/javascript"> $(function(){var str = "http://www.helloweba.com";$('#code').qrcode(str);//canvas$("#sub_btn").click(function(){$("#code").empty();var str = toUtf8($("#mytxt").val());$("#code").qrcode({//tablerender: "table",width: 200,height:200,text: str});}); }) function toUtf8(str) { var out, i, len, c; out = ""; len = str.length; for(i = 0; i < len; i++) { c = str.charCodeAt(i); if ((c >= 0x0001) && (c <= 0x007F)) { out += str.charAt(i); } else if (c > 0x07FF) { out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F)); out += String.fromCharCode(0x80 | ((c >> 6) & 0x3F)); out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F)); } else { out += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F)); out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F)); } } return out; } </script> </head><body> <div id="header"><div id="logo"><h1><a href="http://www.helloweba.com" title="返回helloweba首頁">helloweba</a></h1></div> </div><div id="main"><h2 class="top_title"><a href="http://www.helloweba.com/view-blog-226.html">使用jquery.qrcode生成二維碼</a></h2><div class="demo"><p>請輸入內容然后提交生成二維碼:</p><p><input type="text" class="input" id="mytxt" value=""> <input type="button" id="sub_btn" value="提交"></p><div id="code"></div></div></div><div id="footer"><p>Powered by helloweba.com 允許轉載、修改和使用本站的DEMO,但請注明出處:<a href="http://www.helloweba.com">www.helloweba.com</a></p> </div> </body> </html>

?

轉載于:https://my.oschina.net/lenglingx/blog/871685

總結

以上是生活随笔為你收集整理的利用jquery的qrcode.js插件生成二维码的两种方式的使用的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。