我的问题是:为什么当我在网页上使用“document.lastModified”时,它会返回当前日期和时间,而不是该页面上次修改的时间...
有任何想法吗?
提前致谢 :)
实际代码是:
<script type="text/javascript"> document.write("Page was last modified on: " + document.lastModified);</script>
因为你现在正在修改它。检查一下这个example.
为了根据您的要求进行这项工作,查看此链接 and 这个链接
从外部链接复制:
将其放在页面底部:
<script type="text/javascript" src="js_lus.js"></script>
将文件命名为您想要的任何名称。示例:js_lus.js 确保所有页面的 src="" 路径都是正确的。
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("");
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)