﻿var timerID = null;
var timerRunning = false;

//显示当前时间
function showtime(){
    var now = new Date();
    var year = now.getFullYear();
    var month = now.getMonth();
    var date = now.getDate();
	month += 1;
	if (month < 10) {
		month = "0" + month;
	}
	if (date <= 10) {
		date = "0" + date;
	}
    var timeValue = month + "/" + date + "/" + year;
    document.getElementById("date").innerHTML = timeValue;
    timerID = setTimeout("showtime()",60000);//设置超时,使时间动态显示  
    timerRunning = true;
}
function stopclock(){
    if(timerRunning){
        clearTimeout(timerID);
        timerRunning = false;
    }
}
function startclock(){
     stopclock();
     showtime();
}
addLoadEvent(startclock);