<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 minute_elem = $(id).find('.minute'); <BR>var second_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-new Date().getTime())/1000; <BR>var timer = setInterval(function(){ <BR>if (sys_second > 1) { <BR>sys_second -= 1; <BR>var day = Math.floor((sys_second / 3600) / 24); <BR>var hour = Math.floor((sys_second / 3600) % 24); <BR>var minute = 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:minute);//计算分钟 <BR>$(second_elem).text(second<10?"0"+second:second);//计算秒杀 <BR>} else { <BR>clearInterval(timer); <BR>} <BR>}, 1000); <BR>} <BR></script> <br> </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="minute">00</span> <br><span class="second">00</span> <br> </div> <br> </div> <br>公司做了个秒杀页面,需要做一个倒计时效果,特此收藏 <br><br>代码演示下载:<a href="http://www.jb51.net/jiaoben/103648.html" target="_blank">http://www.jb51.net/jiaoben/103648.html</a>