Countdown JS Small Example

Source: Internet
Author: User

<span class= "Cd_item_txt" id= "Days" >00</span></div>
<div class= "Cd_item cd_hour" ><span class= "Cd_item_txt" id= "hours" >00</span></div>
<div class= "Cd_item cd_minute" ><span class= "Cd_item_txt" id= "Minutes" >00</span></div>
<div class= "Cd_item cd_second" ><span class= "Cd_item_txt" id= "seconds" >00</span></div></ Div>

<script type= "Text/javascript" src= "Js/jquery-1.9.1.min.js" >

function Lefttimer (year,month,day,hour,minute,second) {var lefttime = (new Date (Year,month-1,day,hour,minute,second) )-(New Date ()); Calculates the number of milliseconds left//alert (lefttime); var days = parseint (lefttime/1000/60/60/24, 10); Calculate the remaining days var hours = parseint (lefttime/1000/60/60% 24, 10); Calculate the remaining hours var minutes = parseint (lefttime/1000/60% 60, 10);//calculate remaining minutes var seconds = parseint (lefttime/1000% 60, 10) ;//Calculate the remaining seconds days = Checktime; Hours = Checktime (hours); minutes = Checktime (minutes); seconds = checktime (seconds); document.getElementById ("Days"). InnerHTML = days; document.getElementById ("seconds"). InnerHTML = seconds; document.getElementById ("Minutes"). InnerHTML = minutes; document.getElementById ("hours"). InnerHTML = hours; } function Checktime (i) {//0-9 number is preceded by 0, example 1 becomes i<10 if {i = "0" + i;} return i;}//$seckill _time = ' 2018,04,04,10,0 0,00 '; SetInterval ("Lefttimer ({$seckill _time})", 1000); Change 6 parameters Here, according to the background value lefttimer (); <--second kill time JS End-->

Countdown JS Small example

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.