ステータスバーに現在日時を表示
ステータスバーに今日の日付と現在の時刻を表示します。
ソース
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
<!--
function Clock(){
youbi=new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
myDate=new Date();
myyear=myDate.getFullYear();
mymonth=myDate.getMonth()+1;
myday=myDate.getDate();
myyoubi=youbi[myDate.getDay()];
myhour=myDate.getHours();
myminute=myDate.getMinutes();
mysecond=myDate.getSeconds();
if (mymonth<10) {mymonth="0"+mymonth}
if (myday<10) {myday="0"+myday}
if (myhour<10) {myhour="0"+myhour}
if (myminute<10) {myminute="0"+myminute}
if (mysecond<10) {mysecond="0"+mysecond}
window.status=""+myyear+"/"+mymonth+"/"+myday+" ("+myyoubi+") "+myhour+":"+myminute+":"+mysecond+"";
setTimeout("Clock()",1000);
}
//-->
</SCRIPT>
</head>
<body onload="Clock()">
</body>
</html>
JavaScript GarageのTopへ戻る