JS Countdown Code

Source: Internet
Author: User

JS Countdown One

HTML code:
<script language= "Javas cript" type= "Text/javas cript" >
function DJs () {
var urodz= new Date ("11/12/2008");
var now = new Date ();
var num
var ile = Urodz.gettime ()-now.gettime ();
var dni = Math.floor (ile/(1000 * 60 * 60 * 24));
if (DNI >1)
Num=dni+1
else if (dni = 1) num=2
else if (dni = 0) num=1
else num=0
document.write (num)
}
</script>

Code two

<script language= "Javas cript" >
<!--begin
var timedate= new Date ("January 14,2006");
var times= "Postgraduate examination";
var now = new Date ();
var date = Timedate.gettime ()-now.gettime ();
var time = Math.floor (Date/(1000 * 60 * 60 * 24));
if (time >= 0);
document.write ("<li><font color= #dedbde > Now from 2006" +times+ "also: <font color= #ffffff ><b>" + Time + "</b></font> day </font></li>");
End-->
</script>

Countdown Three

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

Where do you want to show the countdown

<div id= "ShowData" >
</div>

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.