簡易代碼之家

            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)  編輯  收藏

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


          網站導航:
           
          主站蜘蛛池模板: 芦山县| 曲松县| 楚雄市| 车致| 志丹县| 鄄城县| 巴青县| 临猗县| 苏州市| 永顺县| 三门峡市| 梁山县| 蒙城县| 句容市| 隆化县| 丹东市| 叶城县| 吉木萨尔县| 台前县| 邵武市| 屏东市| 全州县| 新民市| 台南市| 泾阳县| 伊春市| 达州市| 河东区| 青岛市| 都兰县| 辽宁省| 岳阳市| 南投市| 大连市| 永修县| 余江县| 荥阳市| 南雄市| 连州市| 溆浦县| 南康市|