ページダイナミックタイム表示

908 ワード


function scroll()
{
	var now=new Date();
	var year=now.getYear();
	var month=now.getMonth()+1;
	var day=now.getDate();
	var week=[' ',' ',' ',' ',' ',' ',' '];  
	var str="  "+week[now.getDay()];  
	var hour=now.getHours();
	var minute=now.getMinutes();  
	var second=now.getSeconds();
	month = dealData(month);
	minute = dealData(minute);
	second = dealData(second);
	document.getElementById("miniDate").innerText=year+" "+month+" "+day+"  "+str+" "+hour+":"+minute+":"+second;
	clocktimer = setTimeout("scroll()", 1000);
}
function dealData(data) {
		if(data < 10) {
			data = "0" + data;
		}
		return data;
}