ホームページの更新日を表示すると再び訪問してくれた方が、「お、新しくなったな」と更新したところを探してくれます。しかし、頻繁にホームページの更新をしているとどうしても更新日表示の変更が忘れがちになります。HTMLファイルにファイル更新日があるのでそれを表示すればいちいち書き変える必要がなくなります。
<script type="text/javascript">
<!--
document.write("更新日:",document.lastModified);
// -->
</script>
<SCRIPT type="text/javascript">
<!--
fuLast = document.lastModified;
now = new Date(fuLast);
fuYear = now.getYear();
if(fuYear<2000){fuYear=fuYear+1900};//ネスケ対策
fuMonth = now.getMonth() + 1;
fuDate = now.getDate();
fuHour = now.getHours();
fuMin = now.getMinutes();
fuSec = now.getSeconds();
if (fuMonth < 10) {fuMonth = "0" + fuMonth;}
if (fuDate < 10) {fuDate = "0" + fuDate;}
if (fuHour < 10) {Hour = "0" + fuHour;}
if (fuMin < 10) {fuMin = "0" + fuMin;}
if (fuSec < 10) {fuSec = "0" + fuSec;}
fuStr = "更新日: " + fuYear + "/" + fuMonth + "/"
+ fuDate;//年月日
fuJikan = " - " + fuHour ;//時間
fuFun = ":"+fuMin ;//分
fuByou = ":"+fuSec ;//秒
document.write( fuStr );//年月日表示
document.write( fuJikan );//時間表示
document.write( fuFun );//分表示
document.write( fuByou );//秒表示
// -->
</SCRIPT>
秒・分・時間の表示がいらないときは削除してください。
<SCRIPT type="text/javascript">
<!--
fuLast = document.lastModified;
now = new Date(fuLast);
fuYear = now.getYear();
if(fuYear<2000){fuYear=fuYear+1900};//ネスケ対策
fuMonth = now.getMonth() + 1;
fuDate = now.getDate();
fuHour = now.getHours();
fuMin = now.getMinutes();
fuSec = now.getSeconds();
if (fuMonth < 10) {fuMonth = "0" + fuMonth;}
if (fuDate < 10) {fuDate = "0" + fuDate;}
if (fuHour < 10) {fuHour = "0" + fuHour;}
if (fuHour < 12) {fuHour = "AM " + fuHour;}else{fuHour = fuHour-12;fuHour
= "PM " + fuHour;}
if (fuMin < 10) {fuMin = "0" + fuMin;}
if (fuSec < 10) {fuSec = "0" + fuSec;}
fuStr = "更新日: " + fuYear + "/" + fuMonth + "/"
+ fuDate;//年月日
fuJikan = " - " + fuHour ;//時間
fuFun = ":"+fuMin ;//分
fuByou = ":"+fuSec ;//秒
document.write( fuStr );//年月日表示
document.write( fuJikan );//時間表示
document.write( fuFun );//分表示
document.write( fuByou );//秒表示
// -->
</SCRIPT>
秒・分・時間の表示がいらないときは削除してください。
* 広告が自動挿入される無料サーバーはアクセスするたびに更新日が変わったり、また、gaiax系のホームページでは表示されません。