will be a string (can be Chinese, in the generation of two-dimensional code image before the Chinese transcoding code to generate two-dimensional code picture, if you want to take a log of two-dimensional code, you can create a two-dimensional code in the middle part of their own add a small log,log picture not too large, otherwise it will not scan out the content.
Copy Code code as follows:
<title></title>
<script src= "Js/jquery-1.8.3.js" type= "Text/javascript" ></script>
<script src= "Js/qrcode.js" type= "Text/javascript" ></script>
<script src= "Js/jquery.qrcode.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 >>) & 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>
Here quoted three JS package, one is jquery package, this casual version, the other two is to draw two-dimensional code with the JS package.
JS Package Download http://download.csdn.net/detail/anxin591025/6254607
PS: Here again to provide a site of the two-dimensional Code generation tool enhanced version (with logos and a variety of custom functions) for everyone to use:
Http://tools.jb51.net/transcoding/jb51qrcode