JS script:
CopyCode The Code is as follows: <script language = "JavaScript" type = "text/JavaScript">
VaR integer = 1000;
Function showcountdown (year, month, day, divname ){
VaR now = new date ();
VaR enddate = new date (year, month-1, day, 14, 07 );
VaR lefttime = enddate. gettime ()-Now. gettime ();
VaR leftsecond = parseint (lefttime/1000 );
VaR day1 = math. Floor (leftsecond/(60*60*24 ));
VaR hour1 = math. Floor (leftsecond-day1*24*60*60)/3600 );
VaR hour = math. Floor (leftsecond-60*60)/3600 );
// If the hour is negative, 0 is displayed
If (hour> 0 ){
}
Else {
Hour = 0;
}
If (day1 <0 ){
Hour = hour1
}
VaR minute = math. Floor (leftsecond-day1*24*60*60-hour1*3600)/60 );
VaR second = math. Floor (leftsecond-day1*24x60*60-hour1 * 3600-minute * 60 );
VaR cc = Document. getelementbyid (divname );
// If the end time is negative, 0 is displayed.
If (lefttime> 0 ){
Cc. innerhtml = hour + "Hour" + minute + "Minute" + second + "second ";
// Cancel the comment if the year is displayed
// CC. innerhtml = "The distance from" + year + "year" + month + "month" + day + "also includes: "+ hour +" Hour "+ minute +" Minute "+ second +" second ";
}
Else {
Cc. innerhtml = 0 + "Hour" + 0 + "Minute" + 0 + "second ";
}
}
// Showdata is the ID of Div, and 10 indicates that the parameter is set based on your needs.
Window. setinterval (function () {showcountdown (2010, 8, 10, 'showdata') ;}, interval );
</SCRIPT>
Add the following code to the location where the time is to be displayed:Copy codeThe Code is as follows: <Div id = "showdata">
</Div>