1. Use jquery to implement the time timer, from a certain period of time to how many days from now how many minutes? How many seconds?
HTML code:
Copy Code code as follows:
<div id= "Times_wrap" class= "Time_num" >
Distance to now time:
<div class= "Time_w" >
<span id= "Time_d" class= "Time" > </span > Day
<span id= "Time_h" class= "Time" > </span >
<span id= "Time_m" class= "Time" > </span > Min
<span id= "time_s" class= "Time" > </span > Sec
</div>
</div>
<script type= "Text/javascript" >
$ (function () {
Show_time ();
});
function Show_time () {
var time_start = new Date ("2013/10/01 00:00:00"). GetTime ()/Set start time
var time_end = new Date (). GetTime (); Set end time (equals system current time)
Calculate Time Lag
var time_distance = Time_end-time_start;
if (Time_distance > 0) {
Timing and seconds conversion
var int_day = Math.floor (time_distance/86400000)
Time_distance-= Int_day * 86400000;
var int_hour = Math.floor (time_distance/3600000)
Time_distance-= Int_hour * 3600000;
var int_minute = Math.floor (time_distance/60000)
Time_distance-= Int_minute * 60000;
var int_second = Math.floor (time_distance/1000)
Time is singular, front plus 0
if (Int_day < 10) {
Int_day = "0" + int_day;
}
if (Int_hour < 10) {
Int_hour = "0" + int_hour;
}
if (Int_minute < 10) {
Int_minute = "0" + int_minute;
}
if (Int_second < 10) {
Int_second = "0" + int_second;
}
Show time
$ ("#time_d"). HTML (int_day);
$ ("#time_h"). HTML (int_hour);
$ ("#time_m"). HTML (Int_minute);
$ ("#time_s"). HTML (Int_second);
SetTimeout ("Show_time ()", 1000);
}else{
$ ("#time_d"). html (' 00 ');
$ ("#time_h"). html (' 00 ');
$ ("#time_m"). html (' 00 ');
$ ("#time_s"). html (' 00 ');
}
}
</script>