為網頁產生二維碼(jquery.qrcode.min.js)

來源:互聯網
上載者:User

標籤:nbsp   jquer   static   cdn   baidu   習慣   src   utf-8   safari   

    做網站活動頁面的時候,要為每個活動產生一個二維碼,雖然簡單,但還是習慣記錄下來。

jquery.qrcode.min.js是js的一個庫,主流的瀏覽器都支援:IE6~10, Chrome, Firefox, Safari, Opera, Mobile Safari, Android, Windows Mobile
方法: qrcode(),
參數:
    text:要編碼的字串地址
    width:定義的寬度
    height:定義的高度
    background:背景色
    foreground:前景色彩
<!doctype html><html><head><meta charset="utf-8" /><title>產生二維碼</title><script type=‘text/javascript‘ src=‘http://cdn.staticfile.org/jquery/2.1.1/jquery.min.js‘></script><script type="text/javascript" src="http://cdn.staticfile.org/jquery.qrcode/1.0/jquery.qrcode.min.js"></script></head><body><div id="qrcode"></div></body><script>$("#qrcode").qrcode({width:64,height:64,text:"https://www.baidu.com/"})</script></html>

  用qrcode.js產生二維碼,預設是canvas畫的

<!doctype html><html><head><meta charset="utf-8" /><title>產生二維碼</title><script type="text/javascript" src="qrcode.js"></script></head><body><div id="qrcode"></div></body><script>new QRCode(document.getElementById("qrcode"),"https://www.baidu.com/")</script></html>

  

  

為網頁產生二維碼(jquery.qrcode.min.js)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.