簡易代碼之家

            BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
            157 Posts :: 2 Stories :: 57 Comments :: 0 Trackbacks
          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
          <html xmlns="http://www.w3.org/1999/xhtml">  
          <head>  
              
          <title>Test生成二維碼,支持中文</title>  
             
          <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.1.min.js"></script>
              
          <script src="jquery.qrcode.min.js" type="text/javascript"></script>  
              
          <script type="text/javascript">  
                  
          function utf16to8(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 > 0x07FF) {  
                              out 
          += String.fromCharCode(0xE0 | ((c >> 12& 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;  
                  }  
                  $(
          function () {  
                      jQuery('#output').qrcode(utf16to8(
          "速凍滑子菇,承德森源綠色食品有限公司,網址:http://xxxxxxx/SitePages/ProductViewNew.aspx?PID=7a988c8f-c148-4a90-a6a8-e713b82a183f"));  
                  })      
              
          </script>  
          </head>  
          <body>  
          <div id="output"></div>  
          </body>  
          </html>
          /Files/jakin/JS文件.rar

          注意:此方法僅支持IE9及以上版本。
          posted on 2014-11-26 15:45 Jakin.zhou 閱讀(521) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 涪陵区| 鱼台县| 长兴县| 河间市| 武乡县| 南郑县| 周宁县| 西吉县| 晋宁县| 昭苏县| 西和县| 屯留县| 喀喇沁旗| 陇川县| 中西区| 璧山县| 永福县| 无棣县| 普安县| 永川市| 巨野县| 兰溪市| 盖州市| 潼关县| 贵州省| 卢湾区| 平山县| 临夏县| 乾安县| 洛隆县| 城固县| 宿州市| 论坛| 巴东县| 芷江| 平昌县| 景宁| 宝坻区| 舒城县| 高淳县| 界首市|