JS get time check and realize Countdown reading bar

Source: Internet
Author: User

<script type= "Text/javascript" >

$ (). Ready (function () {
Each additional switch, will add a row, tab1 unchanged, the other will have to re-name. Then add a set of styles to the CSS.
Timeview ();
});


Refresh Time

SetInterval ("Timeview ();", 1000);
function Timeview () {
var stardate = new Date ("2014/11/05 10:35:00"); Event Start time
var enddate = new Date ("2014/11/05 12:00:00"); Activity End Time
var nowdate = new Date (); Current time
var DIFFHD = Enddate.gettime ()-stardate.gettime (); The number of milliseconds for the time difference
alert (DIFFHD);
Calculate the total number of seconds
var seconds = Math.floor (diffhd/1000);
alert (seconds);
Calculates the difference between the active end time and the current time
var diffseconds = Enddate.gettime ()-(New Date (). GetTime ());
Alert (Enddate.gettime () + "Current time:" + (New Date (). GetTime ()));
alert (diffseconds);
var Divbox =
Timestr = ((diffseconds/seconds)/+) * + "px";
Divbox.style.width = Timestr;
$ (' #time '). CSS ("width", timestr);
jnkc.innerhtml = Timestr;
return timestr;
}

</script>

<style type= "Text/css" >
. time{width:200px; height:30px; background: #F00;}
</style>

<div style= "border:1px solid #000; width:200px; " >
<div id= "Time" class= "Time" ></div>
</div>

JS get time check and realize Countdown reading bar

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.