js怎么写毫秒秒表定时器( 二 )


ss++;
if ((ss % 60) == 0) {
ss = 0;
second ++;
}
if (second >= 60) {
second = 0;
minute++;
}
if (minute >= 60) {
minute = 0;
hour++;
}
timer.innerHTML = j(hour) + ":" + j(minute) + ":" + j(second) + ":" + j(ss)
ctrl.setAttribute("value","暂停");
ctrl.setAttribute("onclick", "pause()");
}
6.如何用js设计一个秒表试试这个
7.自己用js写了一个计时器,原理就是先10秒钟倒计时到0的时候再自动我简单写了个 你看看
<html>
<head></head>
<body onl oad="time()">
<script type="text/javascript">
var count = 11;
function time(){
count--;
if(count <= 0){
count = 6;
time1();
return;
}
document.getElementById('msg').innerHTML = '购买倒计时还剩0分'+count+'秒';
setTimeout(time,1000);
}
function time1(){
count --;
if(count <= 0){
count = 11;
time();
return;
}
document.getElementById('msg').innerHTML = '付款倒计时还剩0分'+count+'秒';
setTimeout(time1,1000);
}
</script>
<div id="msg"></div>
</body>

js怎么写毫秒秒表定时器

文章插图