获取验证码倒计时:
<!DOCTYPE html> <html> <head> <title>获取验证码倒计时</title> </head> <body> <input id="btn" value="获取验证码" onclick="time(this);"> <script type="text/javascript"> var wait = 60; document.getElementById("btn").disabled = false; function time(o) { if (wait == 0) { o.removeAttribute("disabled"); o.value = "获取验证码"; wait = 60; } else { o.setAttribute("disabled", true); o.value = "重新发送(" + wait + ")"; wait--; setTimeout(function() { time(o); }, 1000); } } </script> </body> </html>