在线生成二维码代码实例:
现在二维码似乎已经成了一个流行元素,随便一个网站都要挂上一个二维码,供用户扫描,当然是否真的有用户去扫描就不得而知了,既然如此流行,那就介绍一下如何实现在线生成二维码。
使用jquery.qrcode插件可以实现此功能,在线开源地址是:
https://github.com/jeromeetienne/jquery-qrcode
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; }
原文地址是:http://www.softwhy.com/forum.php?mod=viewthread&tid=8756
更多内容可以参阅:http://www.softwhy.com/jquery/