一個很好用的js倒數!網頁即時倒數,精確到秒級,和天數倒數原理一樣。 js倒數一般用於商城網站團購,特賣,很多地方都可用到!希望能夠帶給大家幫助! 效果如下: 複製程式碼 程式碼 <BR>.leave_time_font{margin-left:35%;} <BR>#fo{margin-left:32%;} <BR> WoYaoNi.CN-倒數 WoYaoNi.CN <BR>$(document).ready(function(e) { <BR>var _countSeconds = 0; <BR>function _countDown() { <BR>_countSeconds ; <BR>$('input.surplustime').each(function(index, element) { <BR>var $this = $(this); <BR>var _totalTime = Number($this. val()) - _countSeconds; <BR>var _day = parseInt(_totalTime/86400); <BR>var _hours = parseInt(_totalTime�400/3600); <BR>var _minutes = parseInt(_minutes = 406_total; <BR>var _seconds = parseInt(_totalTime�400600`); <BR>var _strLite = '<span class="day">' _day '天<span class="hour">' _hours '</ span>小時<span class="minutes">' _minutes '分<span class="seconds">' _seconds '秒'; <BR>var _str = '倒數計時:' _strLite; <BR>if($this.next('p.daojishi').length > 0){ <BR>$this.next('p.daojishi').html(_str); <BR>}else if($this .next('p.leave_time_font').length > 0){ <BR>$this.next('p.leave_time_font').html(_strLite); <BR>} <BR>}); <BR>} <BR>setInterval(_countDown, 1000); <BR>}) <BR> ini_set('date.timezone' ,'Asia/Shanghai'); $currenttime = time(); $a = strtotime('2014-2-14 00:00'); $b = $a-$currenttime; ?> 小夥伴們距離情人節只剩: 0 span>day0小時0分0秒