document.lastModified [英] document.lastModified

查看:97
本文介绍了document.lastModified的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好。如何做document.lastModified与Netscape和Opera一起使用?或者

还有什么方法可以简单地显示关于

当前页面的最后更新日期?

Hi. How to do document.lastModified works with Netscape and Opera ? Or
what other way to take to simply display the last update date about
current page ?

推荐答案



JellyON写道:

JellyON wrote:
嗨。如何做document.lastModified与Netscape和Opera一起使用?或者
还有什么方法可以简单地显示关于
当前页面的最后更新日期?
Hi. How to do document.lastModified works with Netscape and Opera ? Or
what other way to take to simply display the last update date about
current page ?




自所有JavaScript 1.0以来支持document.lastModified永远

已存在/现有的浏览器(包括Netscape和Opera) - 所以我不会
看看哪里有什么问题。


如果您正在寻找一种方法在页面上很好地显示日期,

那么类似于:


< html>

< head>

< title> Last Modified< / title>

< meta http-equiv =" Content-Type" content =" text / html;

charset = iso-8859-1">


< script type =" text / javascript"> ;


函数showLastModified(){

var out = document.getElementById(''lastModified'');

var d = new Date();

if(d.toLocaleDateString){

out.innerHTML = d.toLocaleDateString(document.lastModified);

}

else {

out.innerHTML = document.lastModified;

}

}


window.onload = showLastModified;

< / script>


< / head>

< body>


< p id =" lastModified">& nbsp;< / p>


< / body>

< / html>



document.lastModified supported since JavaScript 1.0 by all ever
existed / existing browsers (including Netscape and Opera) - so I don''t
see where could be any problem.

If you are looking for a way to display the date nicely on the page,
then something like:

<html>
<head>
<title>Last Modified</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">

<script type="text/javascript">

function showLastModified() {
var out = document.getElementById(''lastModified'');
var d = new Date();
if (d.toLocaleDateString) {
out.innerHTML = d.toLocaleDateString(document.lastModified);
}
else {
out.innerHTML = document.lastModified;
}
}

window.onload = showLastModified;
</script>

</head>

<body>

<p id="lastModified">&nbsp;</p>

</body>
</html>


VK于2005年5月15日在comp.lang上写道.javascript
VK wrote on 15 nov 2005 in comp.lang.javascript:
document.lastModified自JavaScript 1.0以来一直支持
存在/ exis浏览器(包括Netscape和Opera) - 所以我不知道哪里可能出现任何问题。
document.lastModified supported since JavaScript 1.0 by all ever
existed / existing browsers (including Netscape and Opera) - so I don''t
see where could be any problem.




应该有警告,

表示asp-pages [并且可能还有php-pages]

每次构建/呈现HTML新(!!!!),

以便不断变化的document.lastModified ,

虽然是正确的,但不是很有用。


-

Evertjan。

荷兰。

(用我的电子邮件地址替换所有带点的十字架)



A warning should be in place,
that "asp-pages" [and probably also "php-pages"]
are constructed/rendered HTML new(!!!!) every time,
so that the ever changing document.lastModified,
while being correct, is not very usefull.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)




Evertjan。写道:

Evertjan. wrote:
应该有一个警告,
asp-pages [并且可能还有php-pages]
每次构建/呈现HTML新(!!!!),以便不断更改document.lastModified,
同时正确,不是很有用。
A warning should be in place,
that "asp-pages" [and probably also "php-pages"]
are constructed/rendered HTML new(!!!!) every time,
so that the ever changing document.lastModified,
while being correct, is not very usefull.




一个好点!

我想正式它是正确的(?)因为document.lastModified

表示上次更改文档的* content *的时间。

如果是ASP,则在服务器端进行解析时发生。

也许是时候介绍一些新的物业,比如

lastTemplateModified? :-)


微软建议在这种情况下在服务器响应中明确设置Last-Modified标题



< http://support.microsoft.com/kb/q165862/>


好​​像是一个很好的解决方法?



A good point!
I guess formally it''s correct (?) because document.lastModified
indicates when the *content* of document has been last time changed.
And in case of ASP it happened during the parsing on the server-side.
Maybe it''s time to introduce some new property like
lastTemplateModified ? :-)

Microsoft suggests in such case to set Last-Modified header explicetly
in the server response:
<http://support.microsoft.com/kb/q165862/>

Seems like a nice workaround?


这篇关于document.lastModified的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆