簡易代碼之家

            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 閱讀(517) 評論(0)  編輯  收藏

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


          網站導航:
           
          主站蜘蛛池模板: 增城市| 怀仁县| 嘉黎县| 玉树县| 沅江市| 涿鹿县| 绥芬河市| 泰州市| 德兴市| 全南县| 彭泽县| 清苑县| 松潘县| 屯留县| 汉源县| 同江市| 安多县| 晋江市| 榆中县| 宁河县| 万安县| 芒康县| 霍城县| 沈阳市| 南昌市| 奉节县| 台湾省| 衡水市| 惠安县| 福鼎市| 闸北区| 寻乌县| 扬中市| 同江市| 莎车县| 丽江市| 龙陵县| 马鞍山市| 徐汇区| 和田市| 沅江市|