var wait=60; function time(o) { if (wait == 0) { o.removeClass("gray"); o.text("发送验证码"); wait = 60; } else { o.addClass("gray"); o.text("重新发送(" + wait + ")s"); wait--; setTimeout(function() { time(o) }, 1000) } }