JS script:
Copy Code code as follows:
<script language= "javascript" type= "Text/javascript" >
var interval = 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 a negative number show 0
if (Hour > 0) {
}
else {
hour = 0;
}
if (Day1 < 0) {
hour = Hour1
}
var minute = Math.floor (leftsecond-day1 * 60-HOUR1 * 3600)/60);
var second = Math.floor (leftsecond-day1 * * 60-HOUR1 * 3600-minute * 60);
var cc = document.getElementById (divname);
Displays 0 if the end time is negative
if (Lefttime > 0) {
Cc.innerhtml = Hour + "Hour" + Minute + "min" + second + "seconds";
If the year is displayed uncomment
cc.innerhtml = "Distance" + year + "years" + month + "Month" + Day + "Days also:" + hour + "hours" + Minute + "min" + second + "seconds";
}
else {
cc.innerhtml = 0 + "Hour" + 0 + "min" + 0 + "seconds";
}
}
ShowData is the div ID 2010,8,10 indicates that the mean parameter is set according to its own requirements.
Window.setinterval (function () {Showcountdown (8, ' ShowData ');}, Interval);
</script>
Add the following code where you want the time to appear:
Copy Code code as follows:
<div id= "ShowData" >
</div>