最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

jquery 顯示*天*時(shí)*分*秒實(shí)現(xiàn)時(shí)間計(jì)時(shí)器

 更新時(shí)間:2014年05月07日 15:38:10   作者:  
用jquery實(shí)現(xiàn)時(shí)間計(jì)時(shí)器,從之前的某個(gè)時(shí)間段到現(xiàn)在距離多少天多少時(shí)多少分多少秒,示例代碼如下,大家拷貝即可使用
1.用jquery實(shí)現(xiàn)時(shí)間計(jì)時(shí)器,從之前的某個(gè)時(shí)間段到現(xiàn)在距離多少天多少時(shí)多少分多少秒?

html代碼:
復(fù)制代碼 代碼如下:

<div id="times_wrap" class="time_num">
距離現(xiàn)在時(shí)間:
<div class="time_w">
<span id="time_d" class="time"> </span >天
<span id="time_h" class="time"> </span >時(shí)
<span id="time_m" class="time"> </span >分
<span id="time_s" class="time"> </span >秒
</div>
</div>

<script type="text/javascript">
$(function(){

show_time();

});

function show_time(){
var time_start = new Date("2013/10/01 00:00:00").getTime();//設(shè)定開始時(shí)間
var time_end = new Date().getTime(); //設(shè)定結(jié)束時(shí)間(等于系統(tǒng)當(dāng)前時(shí)間)
//計(jì)算時(shí)間差
var time_distance = time_end - time_start;
if(time_distance > 0){
// 天時(shí)分秒換算
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)
// 時(shí)分秒為單數(shù)時(shí)、前面加零
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;
}
// 顯示時(shí)間
$("#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>

相關(guān)文章

最新評論

商南县| 清水县| 梓潼县| 自治县| 六盘水市| 吉首市| 靖宇县| 峨眉山市| 全椒县| 黄龙县| 鄱阳县| 明溪县| 霞浦县| 文安县| 舞钢市| 白水县| 民县| 广昌县| 阳高县| 察隅县| 齐齐哈尔市| 金门县| 巧家县| 静宁县| 沾化县| 台前县| 蓝山县| 长葛市| 绥德县| 内江市| 新营市| 德令哈市| 铅山县| 瓮安县| 内黄县| 红河县| 丘北县| 师宗县| 平舆县| 杨浦区| 达尔|