대량 동적 생성 QR코드

4457 단어
대량 동적 생성 QR코드
   
   //  
    $(".qrcode").each(function(){
        var timestamp = new Date().getTime() + Math.random().toString().split(".")[1];  //   +  
        $(this).attr("id", timestamp);
        var q_type = $(this).attr("data-type");
        var q_id = $(this).attr("data-id");
        var qrcode_text = "http://www.domain.cn/qr/?type="+q_type+"&id="+q_id;

        var qrcode = new QRCode(timestamp, {
            width: 140,
            height: 140,
            colorDark: '#000000',
            colorLight: '#ffffff',
            correctLevel: QRCode.CorrectLevel.L
        });
        qrcode.makeCode(qrcode_text);
    });

 





Examples






    
http://baidu.com
http://baidu.com
http://baidu.com
http://baidu.com
http://baidu.com
http://baidu.com
http://baidu.com
http://baidu.com
http://baidu.com
http://baidu.com
<span style="color:#0000ff;">var</span> tags = document.getElementsByTagName('div'<span style="color:#000000;">); </span><span style="color:#0000ff;">for</span> (<span style="color:#0000ff;">var</span> i = tags.length - 1; i >= 0; i--<span style="color:#000000;">) { </span><span style="color:#0000ff;">var</span> _id = tags[i].getAttribute('id'<span style="color:#000000;">); </span><span style="color:#0000ff;">var</span> qrcode = <span style="color:#0000ff;">new</span><span style="color:#000000;"> QRCode(_id, { width: </span>160<span style="color:#000000;">, height: </span>160<span style="color:#000000;">, colorDark: </span>'#000000'<span style="color:#000000;">, colorLight: </span>'#ffffff'<span style="color:#000000;">, correctLevel: QRCode.CorrectLevel.L }); </span><span style="color:#0000ff;">var</span> text =<span style="color:#000000;"> tags[i].innerHTML; qrcode.makeCode(text); } </span>

 
.
다음으로 전송:https://www.cnblogs.com/weiok/p/5983367.html

좋은 웹페이지 즐겨찾기