functionstartTime(){var today =newDate()var year = today.getFullYear();//年var month = today.getMonth()+1;//月var day = today.getDate();//日var week = today.getDay();//星期天var h = today.getHours();//时 var m = today.getMinutes();//分var s = today.getSeconds();//秒// add a zero in front of numbers<10
m =checkTime(m)
s =checkTime(s)
document.getElementById('time').innerHTML = year +"-"+ month +"-"+ day +"/"+ h +":"+ m +":"+ s +"/"+ week
t =setTimeout('startTime()',500)}functioncheckTime(i){if(i <10){
i ='0'+ i
}return i
}//清除计时 clearInterval(startTime);
<div id="time"></div> function startTime() { var today = new Date() var year = today.getFullYear(); //年 var month = today.getMonth() + 1; //月 var day = today.getDate(); //日 var week = today.getDay(); //星期天 var h = tod