我一直在寻找一种方法来显示页面最后更新的日期。
现在我一直在搜索,一切都指向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年的技术课?
按此处查看脚本
I've been looking for a way to display the date the page last was updated.
Now I've been searching around, and everything points to the document.lastModified function, but however I've tried to fix it, it always shows the current date.
I've tried this example:
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("");Or a simple one like this:
<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>Is there any other way to do this? .. Without taking a 3 years tech-class?
Press here to see the scripts live
最满意答案
因为您目前正在修改它。 例如,检查一下。
要根据您的要求进行此项工作,请查看此链接和此链接
检查这将有助于你把它放在底部的页面上:
<script type="text/javascript" src="js_lus.js"></script> Name the file whatever you want. Example: js_lus.js Make sure src="" path is correct for all your pages. 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("");Because you are modifying it currently. Check this out for example.
To make this work based on your requirement, checkout this link and this link
check this it will help u Put this on the page at the bottom:
<script type="text/javascript" src="js_lus.js"></script> Name the file whatever you want. Example: js_lus.js Make sure src="" path is correct for all your pages. 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("");更多推荐
发布评论