JS generates two-dimensional code

Source: Internet
Author: User

Plug-in Description: Jquery.qrcode.js is a client-generated matrix QR code qrcode jquery plug-in, using it can easily generate two-dimensional barcode on the page.

How to use it

Add Jquery.qrcode.min.js and jquery to your Web page

<script src="jquery.min.js"></script><script type="text/ JavaScript "src="jquery.qrcode.min.js"></script>

Then create a DOM element to contain the generated QR code.

<div id="qrcode"></div>

And then you add the QRCode in this container

JQuery ('#qrcode'). QRCode ("http://www.jq22.com");
"Advanced usage"

Specify how the two-dimensional code is generated:

You can enter the desired two-dimensional code generation method (Table/canvas) while calling the function. That is, to generate the corresponding QR code under certain conditions.

//using table GenerationJQuery ('#qrcode'). QRCode ({render:"Table", Text:"http://www.jq22.com"}); //using canvas to buildJQuery ('#qrcode'). QRCode ({render:"Canvas", Text:"http://www.jq22.com"});

Specify the size of the generated QR code:

You can specify the size of the generated QR code by typing the width and height of the QR code you want to generate while calling the function.

// generate a two-dimensional code for 100*100 (width 100, height 100) jQuery ('#qrcode'). QRCode ({        render   "canvas",// can also be replaced by table    width    ,    height  ,    text    "http://www.jq22.com "});

Specify the color style to generate the QR code:

You can specify the color style of the generated QR code by typing the foreground and background colors that you want to generate for the QR code while calling the function.

//generate a two-dimensional code with foreground color red background color whiteJQuery ('#qrcode'). QRCode ({render:"Canvas",//can also be replaced by tableForeground"#C00", background:"#FFF", Text:"http://www.jq22.com"});

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.