js实现计时器

来源:互联网 发布:spss mac版怎么保存 编辑:程序博客网 时间:2024/05/19 19:56

var minus =0;
var second = 0;
var timeCount=0;
function refreshTime(){
timeCount = timeCount+1;
minus = parseInt(timeCount/60);
if(timeCount>=60){
second=parseInt(timeCount%60);
}else{
second = timeCount;
}
if(second<10){
document.getElementById('MsgOfRtu').innerHTML ="通讯中(0"+minus+":"+"0"+second+")...";
}else{
document.getElementById('MsgOfRtu').innerHTML =">通讯中(0"+minus+":"+second+")...";
}
}
resultInterval = setInterval('refreshTime()', 1000);//每秒调用一次

0 0