使用JAVASCRIPT 方式创建二维码
js文件
首先需要第三方的js文件:jquery.qrcode.min.js,在右上角有下载。http://download.how2j.cn/1632/jquery.qrcode.min.js
为了让它可以工作,还需要jquery的js,也在右上角有下载 http://download.how2j.cn/1631/jquery.min.js
为了让它可以工作,还需要jquery的js,也在右上角有下载 http://download.how2j.cn/1631/jquery.min.js
html
用法很简单:
注: 其中的canvas还可以换成 table,用于在不支持html5的浏览器中使用。
$('#qrcode').qrcode({render:'canvas',text:"http://12306.com",width:260,height:260});
注: 其中的canvas还可以换成 table,用于在不支持html5的浏览器中使用。
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
<head><meta http-equiv="Content-Type" content="text/html; charset=GBK"><script src="js/jquery/2.0.0/jquery.min.js"></script><script src="js/qrcode/jquery.qrcode.min.js"></script></head><div style="width:800px;margin:50px auto;text-align:center"><h1>把字符串: http://12306.com 转换为二维码</h1><div id="qrcode"></div></div><script>$(function(){ $('#qrcode').qrcode({render:'canvas',text:"http://12306.com",width:260,height:260}); });</script> |
浙公网安备 33010602011771号