使える!WEB小技集〜JavaScriptで最終更新日を自動的に表示するTips。
1upWEB!ホームページ制作の定番紹介!ノウハウ、小技Tips、検索エンジン、アクセスアップ方法、バナー広告など。1upWeb!,WEB,web,ウェブ,サイト,ホームページ,作成,TIPS,方法,アクセスアップ,JavaScript,CGI,スタイルシート,ダウンロード,フリー,自由,無料,画像  
Home使える!WEB小技集

Last Up 2003年11月21日 (金)

 

●javascriptでの最終更新日の表示

 

<script language="JavaScript">
<!--
// 更新日表示
now = new Date(document.lastModified);
if(navigator.appName=="Microsoft Internet Explorer" && navigator.appVersion.charAt(navigator.appVersion.indexOf("MSIE",0)+5) <= 4) {
now.setTime(now.getTime() + 9*60*60*1000); }
year = now.getYear(); if (year < 2000) year = year + 1900;
month = now.getMonth()+1;
day = now.getDate();
week = now.getDay();
wk = new Array("日","月","火","水","木","金","土");
document.write("■最終更新日:"+year+"年"+month+"月"+day+"日("+wk[week]+")<br>");
// -->
</script>


上記のようにすると、下ようになります。

 

ADVERTISEMENT