function timeCountDown(elementId,seconds){
var a = seconds;
function timedCount() {
document.getElementById(elementId).innerHTML = a;
a = (a == 0 ? 0 : a-1);
setTimeout(function(){ timedCount() }, 1000);
}
timedCount();
}
函数作用:倒计时
参数说明:
参数 |
作用 |
类型 |
elementId |
需要显示倒计时数字的元素id |
字符串 |
seconds |
倒计时的秒数 |
数值 |