現在時刻 時間変化 
<form name="f"> 現在時刻  <input type="text" size=7 name="a" >  </form>
で form を定義しておいてから script は
function clock(){
  today = new Date();
  f.a.value=today.toTimeString();
 setTimeout("clock()",1000);
}

today = new Date();
y=today.getYear();
m=today.getMonth();
d=today.getDate();
h=today.getHours();
n=today.getMinutes();
s=today.getSeconds();
document.write ("本日 ")
document.write(y,"年",m+1,"月",d,"日   ただ今 ",h,"時",n,"分です。<br>");
if (h<12)
  document.write("おはよう");
else if(h<18)
 document.write("こんにちは");
else
 document.write("こんばんは");