簡易代碼之家

            BlogJava :: 首頁 :: 聯(lián)系 :: 聚合  :: 管理
            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(
          "速凍滑子菇,承德森源綠色食品有限公司,網(wǎng)址: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)  編輯  收藏

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


          網(wǎng)站導航:
           
          主站蜘蛛池模板: 杭锦后旗| 措勤县| 湘潭县| 金华市| 兰西县| 民丰县| 弥渡县| 辽中县| 政和县| 天峨县| 宜昌市| 南川市| 民县| 安溪县| 林口县| 海淀区| 四子王旗| 达尔| 台湾省| 邯郸县| 承德市| 碌曲县| 宜都市| 崇文区| 西昌市| 繁峙县| 大理市| 乌海市| 资阳市| 大名县| 琼海市| 河西区| 广饶县| 潮州市| 福海县| 延庆县| 涞源县| 普洱| 和政县| 唐山市| 二连浩特市|