Hello bros and sis’s,
I’m a newbie. I’ve got this function that renders the current calendar year in a browser. In IE, the year “2011” shows up, but nothing shows up in Firefox 3.6.17, wonder if someone could help me figure out why and how to fix it.
var _today = new Date();
var _year = _today.getYear();
if (_year < 200) _year += 1900;
currdate = new Date;
Thanks in advance. [Pardon me for the typo in the title of this post.]
getYear() is not Y2K compliant. It will return different results in different browsers for years from 2000 onwards. It should not be used.
That doesn’t explain why the date isn’t showing though as it is only the last two lines within that script that are actually being used to display the year in the page. Possibly something elsewhere in the page is interfering.
The script type text/jscript is proprietary to Microsoft’s Internet Explorer web browser.