has been used in the Java background call Qrcode.jar form to produce two-dimensional code, and then the web foreground display of the form of the two-dimensional code, and then feel that if you can call the JS framework to produce two-dimensional code will be better soon. At least you can reduce the number of interactions with the browser and reduce the pressure in the background.
Search some information after feeling no one can be used, at least the compatibility of IE browser is still a problem, through their own debugging wrote a demo. Hope to help everyone, save time for everyone
The specific demo can be downloaded via http://download.csdn.net/detail/fugui6611634/7337467.
will be a string (can be Chinese, in the generation of two-dimensional code image before the Chinese transcoding) to generate a two-dimensional code picture, if you want to take log of the QR code, you can create a second-dimensional code in the middle part of their own to add a small log,log picture not too big, otherwise it will not be scanned content.
[HTML] View Plaincopyprint?
- <title></title>
- <script src= "Js/jquery-1.8.3.js" type= "Text/javascript" ></script>
- <script src= "Js/jquery.qrcode.min.js" type= "Text/javascript" ></script>
- <script type= "Text/javascript" >
- $ (function () {
- $ ("#bt"). Bind ("click", Function () {
- Text = $ ("#text"). Val ();
- $ ("#div_div"). QRCode (Utf16to8 (text));
- })
- })
- function Utf16to8 (str) {//transcoding
- 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 >> b) & 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;
- }
- </script>
- <body>
- <input type= "text" id= "text"/>
- <input type= "button" value= "SHENGC" id= "BT"/>
- <div id= "Div_div" style= "width:400px;height:400px;border:1px solid #000;" ></div>
- </body>
- JQuery (' #output '). QRCode ({width:200,height:200,correctlevel:0,text:content});
- For specific parameter descriptions see the following
- Render : "Canvas|table",//Set Rendering mode
- Width : Up to, //Set Wide
- Height : Up to, //set altitude
- Typenumber :-1, //Calculation mode
- Correctlevel : qrerrorcorrectlevel.h,//error correction level
- Background : "#ffffff",//Background color
- Foreground