js实现计时器

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);//每秒调用一次

IT文库 » js实现计时器
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址