<div class="codetitle"> <span><a style="CURSOR: pointer" data="64973" class="copybut" id="copybut64973" onclick="doCopy('code64973')"><u>複製程式碼</u></a></span>程式碼如下:</div> <div class="codebody" id="code64973"> <br><script type="text/javascript"> <BR>$( function(){ <BR>countDown("2015/9/8 11:11:59","#colockbox1"); <BR>}); <BR>function countDown(time,id){ <BR>var day_elem = $(id).find('.day'); <BR>var hour_elem = $(id).find('.hour'); <BR>var 分鐘_elem = $(id).find('.分鐘'); <BR>var secondary_elem = $(id).find('.second'); <br><br>//if(typeof end_time == "string") <BR>var end_time = new Date( time).getTime(),//月份是實際月份-1 <BR>sys_second = (end_time-新的Date().getTime())/1000; <BR>var time = setInterval(function(){ <BR>if (sys_second > 1) { <BR>sys_second -= 1; <BR>var day = Math.floor((sys_second / 3600) / 24); <BR>var 小時= Math.floor((sys_second / 3600) % 24); <BR>var 分鐘= Math.floor((sys_second / 60) % 60); <BR>var Second = Math.floor(sys_second % 60); <BR>day_elem && $(day_elem).text( day);//計算天<BR>$(hour_elem).text(hour<10?"0" hour:hour);//計算小時<BR>$(Minute_elem).text(Minute<10?"0" Minute:Min);//計算分鐘<BR>$(Second_elem).text(Second<10?"0" Second:Second);//計算殺秒<BR>} 其他{ <BR>clearInterval(計時器) <BR>} <BR>}, 1000); <BR>} <BR></腳本> <BR></script> </div> <br>html: <br><div class="codetitle"> <span><a style="CURSOR: pointer" data="56687" class="copybut" id="copybut56687" onclick="doCopy('code56687')"><u>複製程式碼</u></a></span>程式碼如下:</div> <div class="codebody" id="code56687"> <br>< ;div class="colockbox" id="colockbox1"> <br><span class="day">00 span> <br><span class="hour">00</span> <br><span class="分鐘">00</span> <br><span class="second">00</span> <br></span> </div> <br> <br>公司做了個秒殺頁面,需要做一個倒數計時效果,特收藏此<br><br>代碼演示下載:<a href="http://www.jb51.net/jiaoben/103648.html" target="_blank">http://www .jb51.net/jiaoben/103648 .html</a>