实现验证码倒计时

3/3/2017来源:C/C++教程人气:3589

//点击获取验证码后,设置点击按钮禁用,同时显示时间倒数 var count = 60; var countdown = setInterval(CountDown, 1000); function CountDown() { btn.text(count + "s"); if (count == 0) { btn.removeAttr("disabled"); btn.text("获取验证码"); clearInterval(countdown); } count--; }