jquery.qrcode.js is jquery plugin for a pure browser qrcode generation. It allow you to easily add qrcode to your webpages. It is standalone, less than 4k after minify+gzip, no image download. It doesnt rely on external services which go on and off, or add latency while loading. It is based on a library which build qrcode in various language. jquery.qrcode.js wraps it to make it easy to include in your own code.
Show, dont tell, here is a example
convert canvers to an image 微信,浏览器等移动端app在点击图片时可以进行扫描二维码,但是table和canvers是不支持的,所以在原有的基础上进行了简单的修改 支持用户点击二维码时通过app可以进行扫描
Let me walk you thru it. First include it in your webpage with the usual script tag
<script type="text/javascript" src="jquery.qrcode.min.js"></script>
Then create a DOM element which gonna contains the generated qrcode image. Lets say a div
<div id="qrcode"></div>
Then you add the qrcode in this container by
jquery('#qrcode').qrcode("this plugin is great");
This is it. see it live.
You can set the height and width of the generated qrcode:
jquery('#qrcode').qrcode({width: 64,height: 64,text: "size doesn't matter"});
调整了使用方式,如下
jQuery('#qrcodeTable').qrcode({
render : "table",
text : "http://jetienne.com"
});
jQuery('#qrcodeCanvas').qrcode({
render : "canvas",
text : "http://www.baidu.com?id=15454545"
});
jQuery('#qrcodeImage').qrcode({
render : "image",
text : "http://www.baidu.com?id=15454545"
});
here under MIT license. If you hit bugs, fill issues on github. Feel free to fork, modify and have fun with it :)