JSP Source Code Daquan-Countdown Code Generator

Source: Internet
Author: User

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 -->
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.