按钮
<a href="javasript:void(0);"onclick="settime(this);">获取手机验证码</a>
倒计时js
<script> var countdown=60; function settime(obj) { if (countdown == 0) { obj.getAttributeNode(‘onclick‘).value ="settime(this);"; obj.textContent="免费获取验证码"; countdown = 60; return; } else { obj.getAttributeNode(‘onclick‘).value ="javascript:void(0);"; obj.setAttribute("disabled", true); obj.textContent="重新发送(" + countdown + ")"; countdown--; } setTimeout(function() { settime(obj) },1000) } </script>
原文地址:https://www.cnblogs.com/wangzhaobo/p/9055561.html
时间: 2024-10-13 16:44:37