ページが最前面に表示されます
js スクリプト
//現在のシステム時間を表示する最初の方法
function showTime() {
var myArray = new Array(7);
var TD = new Date();
myArray[ 0] = "日曜日";
myArray[1] = "月曜日";
myArray[2] = "火曜日";
myArray[3] = "水曜日";
myArray[4 ] = "木曜日";
myArray[5] = "金曜日";
myArray[6] = "土曜日";
平日 = TD.getDay();
var h = TD.getHours ( );
var m = TD.getMinutes();
var s = TD.getSeconds();
var hstr = h;
var mstr = m;
var istr = s ;
if (h if (m if (s $("#クロック").innerHTML('現在時刻:' new Date().toLocaleDateString() " " myArray[weekday] " " hstr ":" mstr ":" istr );
setTimeout(showTime, 1000);
}
//現在のシステム時刻を表示する 2 番目の方法
function Clock() {
var date = new Date();
this.year=date.getFull Year();
this .month=date.getMonth() 1;
this.date=date.getDate();
this.day=newArray("日曜日","月曜日","火曜日","水曜日"," 木曜日","金曜日","土曜日")[date.getDay()];
this.hour=date.getHours()this. minutes=date.getMinutes()this.second=date.getSeconds()
this.toString=function(){
return "現在時刻は次のとおりです:" this.year "年" this.month "Month" this.date "Day" this.hour ":" this. minutes " : " この.秒 " " この.日;
};
this.toSimpleDate=function(){
returnthis.year "-" this.month "-" this.date;
};
this.toDetailDate=function(){
returnthis.year "-" this.month "-" this.date "" this.hour ":" this. minutes ":" this. Second;
};
this.display=function(ele){
var Clock=newClock();
ele.innerHTML=クロック.toString();
window.setTimeout(function(){ Clock.display(ele) );},1000);
};
}