我的代码:
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('');
}
}
它显示分钟和秒,我想在其中添加小时数。这个怎么做。
帮助表示赞赏。谢谢