0
我一直在尋找一種方法來顯示上次更新頁面的日期。document.lastModified只顯示當前日期?
現在我一直在四處搜尋,一切都指向document.lastModified函數,但是我試圖修復它,它總是顯示當前日期。
我已經試過了這個例子:
function lastModified() {
var modiDate = new Date(document.lastModified);
var showAs = modiDate.getDate() + "-" + (modiDate.getMonth() + 1) + "-" + modiDate.getFullYear();
return showAs
}
function GetTime() {
var modiDate = new Date();
var Seconds
if (modiDate.getSeconds() < 10) {
Seconds = "0" + modiDate.getSeconds(); }
else {
Seconds = modiDate.getSeconds(); }
var modiDate = new Date();
var CurTime = modiDate.getHours() + ":" + modiDate.getMinutes() + ":" + Seconds
return CurTime }
document.write("Last updated on ");
document.write(lastModified() + " @ " + GetTime());
document.write(" [D M Y 24 Hour Clock]"); document.write("");
或者簡單的一個是這樣的:
<SCRIPT LANGUAGE="JavaScript">
var t = new Date(document.lastModified);
document.write("<I>Last Updated: "+document.lastModified+"</I><BR>");
document.write("<I>Last Updated: "+t+"</I><BR>");
</SCRIPT>
是否有任何其他方式做到這一點? ..不用3年的技術課?
Press here to see the scripts live
這實際上是腳本的一個 – JoBe
我目前正在使用.. – JoBe
你有沒有檢查上面給出的鏈接 –