|
List Info
Thread: Re: Simple Javascript Challenge?
|
|
| Re: Simple Javascript Challenge? |

|
2007-01-24 20:18:49 |
|
> Simple Javascript Challenge?
> Posted by: "rawbit64" no_reply@yahoogroups.com rawbit64
> Date: Tue Jan 23, 2007 10:39 am ((PST))
>
> All,
>
> Below is the code. It simply determines the day of the year, such that
> January 23 would be the 23rd day of the year, and March 1st would be
> the 60th day of the year:
>
>
>
> Now, this works find in Firefox and Internet Explorer, but with Safari
> and Konqueror it doesn't! Those two last browsers have a problem with
> getting the variables "when" and "NewYear" for some reason.
>
> Can anyone tell me why? And how to fix it so that it will work in all
> browsers?
>
> TIA.
You've been bitten by the Y2K bug.
The solution is always to use getFullYear() instead of getYear().
getYear() is deprecated because in some browsers it returns the number
of years since 1900. Back in the 20th Century, this was intended to
provide a 2-digit year.
You'll see the same issues with getYear() in older versions of MSIE, and
possibly old Netscape and Opera browsers as well.
getFullYear() always returns a correct 4-digit year.
cheers
jon.
--
This message has not been scanned for viruses.
Since I do not use a Microsoft operating
system or software, and use only plaintext
for email, there is little need for me to do so.
Visit http://aiaiai.com for more groups to join
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/JavaScript_Official/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/JavaScript_Official/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:JavaScript_Official-digest@yahoogroups.com
mailto:JavaScript_Official-fullfeatured@yahoogroups.com
<*> To unsubscribe from this group, send an email to:
JavaScript_Official-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|
[1]
|
|
|
about | contact Other archives ( Real Estate discussion Medical topics )
|