Refer to the following original code. Note: 2007 in the JavaScript code can be replaced.
The following is the webpage source code.
<! -- Complete all scripts in three steps:
1. paste the first part to the head area of HTML
2. Add the onload event to the body tag.
3. Add the last part of code to the body area -->
<! -- Step 1: paste the following code into the head area of HTML -->
<Head>
<Script language = "JavaScript">
<! -- Begin
VaR temp2;
VaR timerid = NULL;
VaR timerrunning = false;
Function arry (){
This. Length = 12;
This [0] = 31;
This [1] = 28;
This [2] = 31;
This [3] = 30;
This [4] = 31;
This [5] = 30;
This [6] = 31;
This [7] = 31;
This [8] = 30;
This [9] = 31;
This [10] = 30;
This [11] = 31;
}
VaR date = new arry ();
Function stopclock (){
If (timerrunning)
Cleartimeout (timerid );
Timerrunning = false;
}
Function startclock (){
Stopclock ();
Showtime ();
}
Function Showtime (){
Now = new date ();
VaR curmonth = now. getmonth ();
VaR curdate = now. getdate ();
VaR curyear = now. getfullyear ();
Now = NULL;
If (1 <curdate ){
Curdate-= date [curmonth]; curmonth ++;
}
If (0 <curmonth ){
Curmonth-= 12; curyear ++;
}
VaR yearleft = 2007-curyear;
VaR monthleft = 0-curmonth;
VaR dateleft = 1-curdate;
Document. dateform. A. value = yearleft;
Document. dateform. B. value = monthleft;
Document. dateform. C. Value = dateleft;
Timerid = setTimeout ("Showtime ()", 1000 );
Timerrunning = true;
}
// End -->
</SCRIPT>
</Head>
<! -- Step 2: add the onload event to the body tag -->
<Body onload = "startclock ()">
<! -- Step 3: add the last part of code to the body zone -->
<Form name = dateform> there are still
<Input type = text name = a size = 2 value = ""> year
<Input type = text name = B size = 2 value = ""> month
<Input type = text name = C size = 2 value = ""> day
</Form>
<! -- Code length: 1.95 kb -->