首页 > 代码库 > 倒计时

倒计时

$(‘.btn‘).click(function(){
var newTime = 60;
var time = function(){
newTime--;
$(‘.btn‘).val(+newTime+"秒");
if(newTime == 0){
clearInterval(timer);
$(‘.btn‘).val("重新获取");
}
}
time();
var timer = setInterval(time,100);
})

倒计时