Tag:ble render html generate QR code func div idt += generate
First through the introduction of the JQ plug-in library--jquery.min.js--jquery.qrcode.min.js then it is relatively simple to prepare the two-dimensional code container directly on the code $ (function () {var str = ToUtf8 (' 123132132123 ');//imgcode is a container for storing two-dimensional code (". Imgcode"). HTML ("); $ (". Imgcode "). QRCode ({render:" table ", Width:200,height : 200,text:str});}) function is the key, do not understand it's okay to call directly on the 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 > 0x07 FF) {out + = String.fromCharCode (0xE0 | ((c >> b) & 0x0F)); O UT + = String.fromCharCode (0x80 | ((c >> 6) & 0x3F)); O UT + = String.fromCharCode (0x80 | ((c >> 0) & 0x3F));} else {out + = String.fromCharCode (0xC0 | ((c >> 6) & 0x1F)); O UT + = String.fromCharCode (0x80 | ((c >> 0) & 0x3F);}} return out;}
JS generates two-dimensional code