The getyear () function of JavaScript is intended to obtain the current "year", for example: <textarea id="runcode44642"></textarea>
[Ctrl + A select all Note: If you need to introduce external JS, You need to refresh it to execute]
Run "2008" in IE, but "108" in Firefox and other browsers ". The reason is that in Firefox and other browsers, getyear returns the value of "current year minus 1900" (that is, the year base is 1900 ). Microsoft Internet Explorer adds 2000 directly when the today year is greater than or equal to 1900, and returns 200 * instead of 10 *. For Firefox and other browsers, you can use the followingCode:
[Ctrl + A select all Note: If you need to introduce external JS, You need to refresh it to execute]
of course, we can also directly use the getfullyear () function:
[Ctrl + A select all Note: To introduce external JS, refresh it before execution]