代码:
countdown = 1800; //设定倒计时妙数
setInterval(showTime, 100); //设定showtime函数0.1s刷新一次
function showTime() {
nnn = countdown-int(getTimer()/1000);
var hour = math.floor(int(nnn/3600));
if (hour<10) {
hour0 = "0"+hour;
} else {
hour0 = hour;
}
var minute = math.floor((nnn-int(nnn/3600)*3600)/60);
if (minute<10) {
minute0 = "0"+minute;
} else {
minute0 = minute;
}
var second = math.floor(nnn-int(nnn/60)*60);
if (second<10) {
second0 = "0"+second;
} else {
second0 = second;
}
calltimedown = hour0+":"+minute0+":"+second0; //以 时:分:秒形式显示
}
效果如下: