在Mozilla中使用document.lastModified的问题 [英] Problem with document.lastModified in Mozilla
问题描述
你好,
我有以下脚本的问题:
函数wr(s)
{
//厌倦了写document.write,
//所以我创建了一个速记版本
document.write(s) ;
}
函数lm()
{
//我知道这可以更短但是原来的脚本
//试图格式化输出字符串,wichh没有
//在Mozilla中工作,所以我评论了很多
//这就是剩下的......
var s = document.lastModified;
返回s;
}
函数lmstring()
{
var s ="此页面最后修改时间:" ;;
s + = lm();
s + ="。" ;;
返回s;
}
< html>
...
< script type =" text / JavaScript">
<! -
wr(lmstring());
// - >
< / script>
....
< / html>
这个_should_返回日期和时间文件上次修改
(已保存),但是在Mozilla中(1.4; Windows ME)它将返回
实际当前日期和时间(好像我使用了new Date())。
在IE中(5.50) )它表现得像我期望的那样。
我做错了什么(或者它是一个Mozilla bug ???)。
(The脚本在外部的.js文件中,如果它应该产生任何
的差异)
-
Bart Broersma
BR **************** *****@tiscali.nl
(ff _ANTISPAM_ wegpoetsen uit dit adres natuurlijk)
Bart a ecrit:
你好,
我遇到以下脚本的问题:
函数wr(){document.write(lmstring()); }
函数wr(s)
//
//厌倦了编写document.write,
//所以我创建了一个速记版本
document.write(s);
}
函数lm()
//
//我知道这可以更短但原始脚本/ //试图格式化输出字符串,wichh没有在Mozilla中工作,所以我评论了很多
//这就是它剩下的......
var s = document.lastModified;
返回s;
}
函数lmstring()
{
var s ="本页最后修改时间:" ;;
s + = lm();
s + ="。" ;;
返回s;
}
< html>
< script type =" text / JavaScript">
<! -
wr(lmstring());
// - >
< / script>
...
< / html>
这个_should_返回文档上次修改的日期和时间
(已保存),但是在Mozilla(1.4; Windows ME)中t将返回
实际当前日期和时间(好像我使用了new Date())。
在IE(5.50)中,它的行为与我期望的一样。
我做错了什么(或者它是一个Mozilla bug ???)。
(脚本在外部.js文件中,如果这应该有任何不同的区别)
-
Bart Broersma
***** ********************* @ tiscali.nl
(ff _ANTISPAM_ wegpoetsen uit dit adres natuurlijk)
-
********(enlever / remove [OTER_MOI] du /来自回复网址)*******
$ b $bStéphaneMORIAUX:mailto:st ********************* @ wanadoo.fr
Aide aux Pages Perso (图片& couleurs,formulaire,CHP,JS)
http:// perso .wanadoo.fr / stephane.moriaux / internet /
*************************** *********************** ************
2004年2月2日星期一17:34:38 + 0100" @ SM"写道:
< st ********************* @ wanadoo.fr>:
function wr(){document.write(lmstring()); }
实际上我在所有页面中使用wr()函数而不是
document.write,所以这对我来说无法解决任何问题。
我觉得你误解了我的问题。
正如我可以追踪的那样,document.lastModified没有返回日期
文件是最后一个修改,但实际的当前日期&时间......
巴特
-
Bart Broersma
BR *********** @ Tiscali公司.nl
(ff _ANTISPAM_ wegpoetsen uit dit adres natuurlijk)
Op Sun,2004年2月1日18:30:26 + 0100 schreef Bart
< br ********************* @ tiscali.nl>:
刚刚测试了这个(Windows ME上的Mozilla 1.4)
< script type =" text / JavaScript">
<! - -
document.write(document.lastModified);
// - >
< / script>
这将返回我的计算机时钟的实际时间和日期,_NOT_,
,因为一个人应该注意,日期&上次修改文件的时间。
(保存在浏览器中打开的HTML:给了我2月02日,18:36;
然后更改了计算机时钟到2004年12月2日,重新加载页面
它给了我2004年12月2日18:36....)
Netscape 6.0在同一个剧本上表现正确...
任何人都可以重现这个????
巴特
-
Bart Broersma
br ********************* @ tiscali.nl
(ff _ANTISPAM_ wegpoetsen uit dit adres natuurlijk)
Hallo,
I''m have a problem with the following script:
function wr(s)
{
//Just got tired of writing document.write,
//so I created a shorthand version
document.write(s);
}
function lm()
{
//I know this can be shorter but the original script
//tried to format the outputstring, wichh did not
//work in Mozilla, so I commented a lot out
//and this is what''s left of it...
var s = document.lastModified;
return s;
}
function lmstring()
{
var s = "This page was last modified at: ";
s += lm();
s += ".";
return s;
}
<html>
...
<script type="text/JavaScript">
<!--
wr(lmstring());
// -->
</script>
....
</html>
This _should_ return the date and time the document was last modified
(saved), however in Mozilla (1.4; Windows ME) it will return the
actual current date and time (as if I''d used "new Date()").
In IE (5.50) it behaves as I expect.
What am I doing wrong (or is it a Mozilla bug ???).
(The script is in an external .js file, if that should make any
difference)
--
Bart Broersma
br*********************@tiscali.nl
(ff _ANTISPAM_ wegpoetsen uit dit adres natuurlijk)
Bart a ecrit :
Hallo,
I''m have a problem with the following script:
function wr() { document.write(lmstring()); }
function wr(s)
{
//Just got tired of writing document.write,
//so I created a shorthand version
document.write(s);
}
function lm()
{
//I know this can be shorter but the original script
//tried to format the outputstring, wichh did not
//work in Mozilla, so I commented a lot out
//and this is what''s left of it...
var s = document.lastModified;
return s;
}
function lmstring()
{
var s = "This page was last modified at: ";
s += lm();
s += ".";
return s;
}
<html>
..
<script type="text/JavaScript">
<!--
wr(lmstring());
// -->
</script>
...
</html>
This _should_ return the date and time the document was last modified
(saved), however in Mozilla (1.4; Windows ME) it will return the
actual current date and time (as if I''d used "new Date()").
In IE (5.50) it behaves as I expect.
What am I doing wrong (or is it a Mozilla bug ???).
(The script is in an external .js file, if that should make any
difference)
--
Bart Broersma
br*********************@tiscali.nl
(ff _ANTISPAM_ wegpoetsen uit dit adres natuurlijk)
--
******** (enlever/remove [OTER_MOI] du/from reply url) *******
Stéphane MORIAUX : mailto:st*********************@wanadoo.fr
Aide aux Pages Perso (images & couleurs, formulaire, CHP, JS)
http://perso.wanadoo.fr/stephane.moriaux/internet/
************************************************** ************
On Mon, 02 Feb 2004 17:34:38 +0100 "@SM" wrote:
<st*********************@wanadoo.fr>:
function wr() { document.write(lmstring()); } Actually I use the wr() function in all my pages instead of
document.write, so this won''t solve anything for me.
I think you misunderstood my question.
As fa as I can trace, document.lastModified does not return the date
the document was last modified, but the actual current date & time...
Bart
--
Bart Broersma
br*********************@tiscali.nl
(ff _ANTISPAM_ wegpoetsen uit dit adres natuurlijk)
Op Sun, 01 Feb 2004 18:30:26 +0100 schreef Bart
<br*********************@tiscali.nl>:
Just tested this (Mozilla 1.4 on Windows ME)
<script type="text/JavaScript">
<!--
document.write(document.lastModified);
// -->
</script>
This will return the actual time and date of my computer clock, _NOT_,
as one should ecxpect, the date & time the document was last modified.
(saved the HTML opened in browser: gave me "february 02, 18:36";
then changed computer clock to december 2nd 2004, reloaded the page
and it gave me "december 02, 2004 18:36" ....)
Netscape 6.0 behaves correctly on the same script...
Can anyone reproduce this ????
Bart
--
Bart Broersma
br*********************@tiscali.nl
(ff _ANTISPAM_ wegpoetsen uit dit adres natuurlijk)
这篇关于在Mozilla中使用document.lastModified的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!