Copy codeThe Code is as follows:
<Script type = "text/javascript">
Var date = new Date ();
Function initArray (){
This. length = initArray. arguments. length;
For (var I = 0; I <this. length; I ++ ){
This [I] = initArray. arguments [I];
}
}
Var d = new initArray (
'Sunday ',
'Monday ',
'Tuesday ',
'Weday ',
'Thursday ',
'Friday ',
'Saturday'
);
// The Firfox browser shows that the Year is obtained by getYear () from the current year minus 1900.
Document. write (date. getYear ()> 1900? Date. getYear (): date. getYear () + 1900) + "year ");
Document. write (date. getMonth () + 1 + "month ");
Document. write (date. getDate () + "day ");
Document. write (d [date. getDay ()]);
</Script>
Because JavaScript does not support arrays, use the following code to define the initialization array.
Function initArray (){
This. length = initArray. arguments. length;
For (var I = 0; I <this. length; I ++ ){
This [I] = initArray. arguments [I];
}
}