Javacript doesn't work in Firefox

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.

<script type="text/jscript">
				    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.

text/javascript is the standard type to use.

Oops - missed seeing the type was set that way - Opera will also unfortunately allow the JavaScript to be run in that instance.

No - the standard type is “application/javascript”.

“text/javascript” is deprecated but has to be used because Internet Explorer doesn’t understand the standard one.

It looks like we have a slight difference of opinion about that. I’m using “standard” according to the definition of “by general consent as a basis of comparison” whereas if we were talking about what is laid down by “the standards” or the JavaScript specifications, then I’m in total agreement with you there.

I’m just wondering what the first three lines are even for – since they aren’t even used on the page. Though yeah, app/js is what you should use by the spec, but it doesn’t actually work any better than text/jscript does – text/javascript is what should be there if you care about it actually working.

But then I don’t understand why application/javascript would be the appropriate as that’s code… uncompiled without an interpreter that’s text, NOT an application. Lemme guess it’s like the re-re’s who call XML a “machine readable format”? (as a machine language coder I take great exception to that)