﻿
function Watch() {
now = new Date();
year = now.getYear();
month = now.getMonth()+1;
day = now.getDate();
youbi = new Array("(日)","(月)","(火)","(水)","(木)","(金)","(土)");
hour = now.getHours();
minute = now.getMinutes();
second = now.getSeconds();
if (year < 1000) { year += 1900 }
if (month < 10) { month = '0' + month }
if (day < 10) { day = '0' + day }
if (hour < 10) { hour = '0' + hour }
if (minute < 10) { minute = '0' + minute }
if (second < 10) { second = '0' + second }
document.getElementById("time").innerHTML =year + '年' + month + '月' + day + '日' + youbi[now.getDay()] + ' ' + hour + ':' + minute; setTimeout('Watch()',1000);
}

function addEvent(elm,listener,fn){
	try{
		elm.addEventListener(listener,fn,false);
	}catch(e){
		elm.attachEvent("on"+listener,fn);
	}
}

addEvent(window,"load",Watch);
	
