js倒计时一分钟

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>count down</title>
</head>

<body>
<script type="text/javascript">
var seconds = 59;
var speed = 1000;
var span = document.createElement('span');
        document.body.appendChild(span);
function countDown(seconds,speed){
                var txt = "00 : " + ((seconds < 10) ? "0" + seconds : seconds) + " : 00";
                span.innerHTML = txt;
                var timeId = setTimeout("countDown(seconds--,speed)",speed);
                if(seconds == 0){
                        clearTimeout(timeId);
                };
}

countDown(seconds,speed);
</script>
</body>
</html>

上一篇:SQL CE 和 SQLite数据库对比测试


下一篇:WPF获得全局窗体句柄,并响应全局键盘事件