JS generates two-dimensional code

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.