短信倒計(jì)時(shí),哪里出問(wèn)題了不執(zhí)行,也不報(bào)錯(cuò)!<!DOCTYPE html><html><head> <meta charset="UTF-8"> <title>短信倒計(jì)時(shí)</title></head><body> <input type="text"> <button id="btn">點(diǎn)擊發(fā)送短信</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 = "重新發(fā)送短信"; _this.disabled = false; clearInterval(timer); } } } } </script></body></html>
短信倒計(jì)時(shí),哪里出問(wèn)題了不執(zhí)行,也不報(bào)錯(cuò)!
搖曳的薔薇
2018-12-04 13:31:02