我的代码:
var mins = 30;
var secs = mins * 60;
var currentSeconds = 0;
var currentMinutes = 0;
setTimeout("Decrement("+secs+")",1000);
function Decrement(secs){
secs = parseInt(secs);
currentMinutes = Math.floor(secs / 60);
currentSeconds = secs % 60;
if(currentSeconds <= 9) currentSeconds = "0" + currentSeconds;
secs--;
$("#countdown").html(currentMinutes + ":" + currentSeconds);
if(secs !== -1){
setTimeout("Decrement("+secs+")",1000);
}
if(secs == 0){
alert('');
}
}
帮助表示感谢。感谢名单
答案 0 :(得分:0)
这是一个倒计时器给你
http://keith-wood.name/countdown.html
它有几分钟和几秒钟。 您可以设置倒计时的日期,如果您阅读文档,则不会很难使用。简单用法:但是当你想要更多设置我建议阅读整个文档
$(selector).countdown()