Last week, I was sorting out a calendar script that I wrote previously. FF always had problems with the display of the year, and I was so depressed. For example, the following script prompts "2007" under IE -- No problem! But does FF prompt "107 "?
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
After a Google query, we can see that the value of "current Year-1900" is returned in FF's getYear (which is said to have been handled in the past), while NB's MS is regarded as Year> = 2000, add the subtract 1900 again. Haha, I once again admire the fault tolerance capability and belly capacity of IE ^_^
The most direct solution is year = (year <1900 )? (1900 + year): year;
Of course, you have to judge the Browser type and then classify it.
The most reasonable thing is to call getYear with getFullYear or getUTCFullYear. You can change the corresponding Code in the Code box above to see the effect.