Skip to content

Commit 4914702

Browse files
committed
change qrcode-demo2
1 parent 3087791 commit 4914702

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

qrcode/qrcode-demo2.html

+5-1
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,16 @@
1313
window.onload=function(){
1414
var oQrCode=document.getElementById('qrcode');
1515
var oT=document.getElementById('t1');
16+
var oT2=document.getElementById('t2');
1617
var oBtn=document.getElementById('btn1');
18+
var oSpan=document.querySelector('#qrcode .img');
1719

1820
var qrCode=new QRCode(oQrCode,{width:200, height:200});
1921

2022
qrCode.makeCode('http://www.itstrive.com'); //默认随便给一个
2123

2224
oBtn.onclick=function(){
25+
oSpan.style.backgroundImage='url('+oT2.value+')';
2326
qrCode.makeCode(oT.value);
2427
};
2528
};
@@ -30,7 +33,8 @@
3033
<div id="qrcode">
3134
<span class="img"></span>
3235
</div>
33-
<input type="text" id="t1">
36+
二维码地址:<input type="text" placeholder="http://www.baidu.com" id="t1">
37+
中心图像地址:<input type="url" placeholder="https://www.baidu.com/img/bd_logo1.png" id="t2">
3438
<input type="button" value="生成二维码" id="btn1">
3539
</body>
3640
</html>

0 commit comments

Comments
 (0)