| MENUへ | 元のページに戻る |
|
■ 1 日付・時刻を表示する。(呼び出し時の時刻) ■ 2 時刻をリアルタイムで表示する |
| Top へ |
<HTML>
<HEAD>
<TITLE>・・・・・・</TITLE>
<script language="JavaScript">
<!--
function printtime(){
youbi =new Array("日","月","火","水","木","金","土");
mytime =new Date();
mydate =mytime.getDate();
myyoubi =youbi[mytime.getDay()];
myyear =mytime.getFullYear();
mymonth =mytime.getMonth()+1;
myhour=mytime.getHours();
myminutes=mytime.getMinutes();
myseconds=mytime.getSeconds();
if( myhour<"4") document.write("こんな時間にご苦労様です!! ");
if( myhour>"23") document.write("こんな時間にご苦労様です!! ");
if( myhour<"10" & myhour>"3") document.write("おはようございます!! ");
if( myhour<"19" & myhour>"9") document.write("こんにちは!! ");
if( myhour<"23" & myhour>"18") document.write("こんばんわ!! ");
document.write(" ただいま "+myyear+" 年 "+mymonth+" 月 "+mydate+" 日 ("+myyoubi+")、")
document.write("時間は "+myhour+" 時 "+myminutes+" 分です。");
document.write("\n<BR>");
}
//-->
</script>
</HEAD>
<BODY background="icon/gray.jpg">
<script language="JavaScript">
<!--
printtime();
//-->
</script>
</BODY>>
</HTML>
| Top へ |
<HTML>
<HEAD>
<TITLE>・・・・・・</TITLE>
<script language="JavaScript">
<!--
var doc=" ";
i=0;
function printtime2()
{
youbi2 =new Array("日","月","火","水","木","金","土");
mytime2 =new Date();
mydate2 =mytime2.getDate();
myyoubi2 =youbi[mytime2.getDay()];
myyear2 =mytime2.getFullYear();
mymonth2 =mytime2.getMonth()+1;
myhour2 =mytime2.getHours();
myminutes2=mytime2.getMinutes();
myseconds2=mytime2.getSeconds();
if( myhour2<"4") doc=" こんな時間にご苦労様です!! ";
if( myhour2>"22") doc=" こんな時間にご苦労様です!! ";
if( myhour2<"10" & myhour>"3") doc=" おはようございます!! ";
if( myhour2<"19" & myhour>"9") doc=" こんにちは!! ";
if( myhour2<"23" & myhour>"18") doc=" こんばんわ!! ";
doc=doc+" ただいま "+myyear2+" 年 "+mymonth2+" 月 "+mydate2+" 日 ("+myyoubi2+")、";
doc=doc+時間は "+myhour2+" 時 "+myminutes2+" 分です。";
doc=doc+"......";
if(i<=doc.length)
{document.myform.mydoc.value=doc.substring(0,i);
i=i+1;
setTimeout("printtime2()",100);}
else
{i=0;
setTimeout("printtime2()",1000);}
}
//-->
</script>
</HEAD>
<BODY onLoad="printtime2()">
<form name="myform"><input name='mydoc' size='110'></form>
</BODY>
| Top へ |