js生成二維碼(jquery自帶)

//引入js
<
script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="js/jquery.qrcode.min.js"></script> function makecode(){   $("#code").qrcode({     // render: "table", //table方式     width: 200, //寬度     height:200, //高度     text: "${result.attributes.code}" //二維碼內容   });   alert("二維碼已生成,請上滑屏幕查看二維碼"); }
<html>
  <div id="code"  align="center" margin="10px auto"></div>

   <div class="btn_con" >
    <button onclick="makecode()" id="makecode" >生成二維碼</button>
   </div>javascript

</html>

render方式爲table時: 二維碼內容複雜在pc端打開能夠用手機掃描,在手機端用手機打開二維碼頁面掃描不了html

二維碼內容簡單在pc端打開頁面掃描不了,在手機端用手機打開二維碼頁面能夠掃描java

解決辦法:去掉render;不管二維碼是否複雜,手機pc端打開頁面,手機均可以掃描二維碼jquery

具體緣由不知,請大神賜教,如今記錄下,知道結果在跟新博文spa

 

 

ps:本文爲博主原創,轉載請註明出處:http://www.cnblogs.com/Y-zhiwei/。code

相關文章
相關標籤/搜索