短信倒计时,哪里出问题了不执行,也不报错!<!DOCTYPE html><html><head> <meta charset="UTF-8"> <title>短信倒计时</title></head><body> <input type="text"> <button id="btn">点击发送短信</button> <script> window.onload = function(){ var btn = document.getElementById("btn"); var con = 5; var _this = this; var timer = null; btn.onclick = function(){ clearInterval(timer); timer = setInterval(sendMessage,1000); function sendMessage(){ con --; if(con >= 0){ _this.innerHTML = "还剩余" + con + "秒"; }else{ _this.innerHTML = "重新发送短信"; _this.disabled = false; clearInterval(timer); } } } } </script></body></html>
添加回答
举报
0/150
提交
取消