The JavaScript getyear () function is intended to get the current "year", such as:
<script type= "Text/javascript" > var nowd = new Date (); var YF = Nowd.getyear (); alert (YF); </script>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
In IE browser execution for the correct "2008", but Firefox and other browsers under the implementation of "108". The reason is that in Firefox and other browsers getyear returns the "current year minus 1900" value (that is, the year Base is 1900). Microsoft's IE is when today's year is greater than or equal to 2000, directly add 1900, return is 200*, not 10*. So for browsers such as Firefox, you can use the following code:
<script type= "Text/javascript" > var nowd = new Date (); var YF = Nowd.getyear (); YF = (yf<1900? ( 1900+YF): YF); alert (YF); </script>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
Of course, we can also use the getFullYear () function directly:
<script type= "Text/javascript" > var nowd = new Date (); var YF = Nowd.getfullyear (); alert (YF); </script>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]