Javascript将无法在FIREFOX中正确显示日期,在EXPLORER中无法正常显示

问题描述:

您好。我无法解读为什么我的网页上的javascript:

http://www.psych.nmsu.edu/~jkroger/lab/index.html


不显示在Firefox中正确日期。而不是2005而不是2005。对于

年份,

显示为105。 ...但是,在IE浏览器中,它看起来很好。

感谢您的帮助,

Jim

Hi. I am at a loss to decipher why the javascript on my web page:

http://www.psych.nmsu.edu/~jkroger/lab/index.html

does not display the date correctly in Firefox. Instead of "2005" for
the year,
it displays "105" ... however, in IE Explorer, it looks fine.
Thanks for any help,
Jim

< kr **** @ princeton.edu>在消息中写道

news:11 ********************* @ z14g2000cwz.googlegro ups.com ...
<kr****@princeton.edu> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
嗨。我无法解读为什么我的网页上的javascript:

http://www.psych.nmsu.edu/~jkroger/lab/index.html

在Firefox中无法正确显示日期。而不是2005而不是2005。对于
年份,它显示105和105。 ...但是,在IE浏览器中,它看起来很好。
感谢您的帮助,
Jim
Hi. I am at a loss to decipher why the javascript on my web page:

http://www.psych.nmsu.edu/~jkroger/lab/index.html

does not display the date correctly in Firefox. Instead of "2005" for
the year,
it displays "105" ... however, in IE Explorer, it looks fine.
Thanks for any help,
Jim




更改

year = now.getYear();

to

year = now.getFullYear();



Change
year = now.getYear();
to
year = now.getFullYear();


&QUOT; McKirahan&QUOT; &LT;氖** @ McKirahan.com&GT;在消息中写道

news:ob ******************** @ comcast.com ...
"McKirahan" <Ne**@McKirahan.com> wrote in message
news:ob********************@comcast.com...
&lt ; KR **** @ princeton.edu&GT;在消息中写道
新闻:11 ********************* @ z14g2000cwz.googlegro ups.com ...
<kr****@princeton.edu> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
你好。我无法解读为什么我的网页上的javascript:

http://www.psych.nmsu.edu/~jkroger/lab/index.html

在Firefox中无法正确显示日期。而不是2005而不是2005。今年是
它显示105。 ...但是,在IE浏览器中,它看起来很好。
感谢您的帮助,
Jim
Hi. I am at a loss to decipher why the javascript on my web page:

http://www.psych.nmsu.edu/~jkroger/lab/index.html

does not display the date correctly in Firefox. Instead of "2005" for
the year,
it displays "105" ... however, in IE Explorer, it looks fine.
Thanks for any help,
Jim



更改
year = now.getYear( );
年份= now.getFullYear();



Change
year = now.getYear();
to
year = now.getFullYear();




getYear和getFullYear
http://www.quirksmode.org/js/datecompat.html
> http://www.developersdex.com /asp/mes...2978&r=3701766



getYear and getFullYear
http://www.quirksmode.org/js/datecompat.html

http://www.developersdex.com/asp/mes...2978&r=3701766


JRS:文章< 11 ************ *********@z14g2000cwz.googlegroups。 com>,

日期为2005年1月28日星期五17:18:15,见于新闻:comp.lang.javascript,
kr **** @ princeton.edu 发布:
JRS: In article <11*********************@z14g2000cwz.googlegroups. com>,
dated Fri, 28 Jan 2005 17:18:15, seen in news:comp.lang.javascript,
kr****@princeton.edu posted :
嗨。我无法解读为什么我的网页上的javascript:

http://www.psych.nmsu.edu/~jkroger/lab/index.html

在Firefox中无法正确显示日期。而不是2005而不是2005。今年是
它显示105。 ...但是,在IE浏览器中,它看起来很好。
Hi. I am at a loss to decipher why the javascript on my web page:

http://www.psych.nmsu.edu/~jkroger/lab/index.html

does not display the date correctly in Firefox. Instead of "2005" for
the year,
it displays "105" ... however, in IE Explorer, it looks fine.




在发布到新闻组之前,您应该阅读其常见问题解答;这个

组的常见问题解答每周发布三次,分两部分。


的确,你应该在编写网页之前阅读相关的常见问题解答;你节省下来的时间包括你自己。


可能你正在使用方法getYear,各种系统中的AIUI

可以用于当前日期返回5,105或2005.


方法getFullYear在当前浏览器中可用(但要小心

如果您是为第三世界写作或偏僻的学院)。一个

程序员可以从getYear和getTime构造它。但如果

即当前日期,那么

(a)2000 + getYear()%100会做很长一段时间

( b)告诉读者当前日期是浪费带宽。


-

?约翰斯托克顿,英国萨里。 ?@merlyn.demon.co.uk Turnpike v4.00 IE 4?

< URL:http://www.jibbering.com/faq/> JL / RC:新闻常见问题:comp.lang.javascript

< URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr数学,日期,来源。

< URL:http://www.merlyn.demon.co.uk/> TP / BP / Delphi / jscr /& c,常见问题项目,链接。



Before posting to a newsgroup, you should read its FAQ; the FAQ for this
group is posted thrice a week, in two parts.

Indeed, you should read relevant FAQs before writing Web pages too; the
time you thus save includes your own.

Probably you are using method getYear which AIUI in various systems
can for current dates return 5, 105, or 2005.

Method getFullYear is available in current browsers (but be careful
if you are writing for the third world or backwoods colleges). And a
programmer can construct it from getYear and getTime . But if
that is the current date, then
(a) 2000 + getYear()%100 will do for quite a while
(b) telling the reader the current date is a waste of bandwidth.

--
? John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ?
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.