js"发送验证码"倒计时效果!
发送验证码倒计时很简单,昨天作的,今天贴出来,作个记录,也请朋友看看,可以不优化一下!
<input type="button" id="fsyzm" onclick="timedCount()" class="btn5" value="发送校验码" /> <script type="text/javascript"> var Time=3, t; var c=Time function timedCount(){ document.getElementById('fsyzm').value="请稍等(" + c + ")"; document.getElementById('fsyzm').disabled="disabled"; c=c-1; t=setTimeout("timedCount()",1000) if(c<0){ c=Time; stopCount(); document.getElementById('fsyzm').value="发送校验码"; document.getElementById('fsyzm').removeAttribute("disabled"); } } function stopCount(){ clearTimeout(t); } </script>
cssfirefly
http://cssfirefly.cnblogs.com