用js实现拼接url引用外部api生成二维码

Original 2019-06-12 21:32:20 419
abstract:<!doctype html><html><head><meta charset="utf-8"><title>js生成二维码</title><script type="text/javascript" src="http://static.runoob.com/asse

<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>js生成二维码</title>

<script type="text/javascript" src="http://static.runoob.com/assets/qrcode/qrcode.min.js"></script>

</head>


<body>

<script type="text/javascript">

var T = Math.round(new Date() / 1000);

var url ='https://www.baidu.com/w/q/133%263%26105925'

function Money (m){

document.getElementById("code").style="display:block;"

money = document.getElementById('money').value -0;

qr = url+"%26"+money*100+"%26"+T+"168";

document.getElementById("code").src='http://qr.liantu.com/api.php?text='+qr;

}

</script>


请输入金额<input id="money" type="text" >

<input type="button" value="生成" onClick="Money(this)">

<img width="200" height="200" style="display:none;" src="" id="code" />


</body>

</html>


Correcting teacher:查无此人Correction time:2019-06-13 09:12:46
Teacher's summary:完成的不错。js是终生学习语言,功能非常强大。继续加油

Release Notes

Popular Entries