企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# 点击发送短信 倒计时 ## html部分 ~~~ <input class="weui_btn weui_btn_mini weui_btn_default " type="button" id="btn" value="发送短信" onclick="settime(this)" /> ~~~ ## js部分 ~~~ var sleep = 60, interval = null; window.onload = function () { var btn = document.getElementById ('btn'); btn.onclick = function () { if (!interval) { this.style.backgroundColor = '#ccc'; this.disabled = "disabled"; this.style.cursor = "wait"; this.value = "重新发送 (" + sleep-- + ")"; interval = setInterval (function () { if (sleep == 0) { if (!!interval) { clearInterval (interval); interval = null; sleep = 60; btn.style.cursor = "pointer"; btn.removeAttribute ('disabled'); btn.value = "免费获取验证码"; btn.style.backgroundColor = ''; } return false; } btn.value = "重新发送 (" + sleep-- + ")"; }, 1000); } } } ~~~