JS脚本: 复制代码代码如下: <BR>var 间隔 = 1000; <BR>function ShowCountDown(年、月、日、divname) { <BR>var now = new Date(); <BR>var endDate = new Date(年,月 - 1,日,14,07); <BR>var leftTime = endDate.getTime() - now.getTime(); <BR>var leftsecond = parseInt(leftTime / 1000); <BR>var day1 = Math.floor(leftsecond / (60 * 60 * 24)); <BR>var hour1 = Math.floor((leftsecond - day1 * 24 * 60 * 60) / 3600); <BR>var hour = Math.floor((leftsecond - 60 * 60) / 3600); <BR>//如果小时为负数显示0 <BR>if (hour > 0) { <BR>} <BR>else { <BR>hour = 0; <BR>} <BR>if (day1 < 0) { <BR>hour = hour1 <BR>} <BR>var 分钟 = Math.floor((leftsecond - day1 * 24 * 60 * 60 - hour1 * 3600) / 60); <BR>var secondary = Math.floor(leftsecond - 第 1 天 * 24 * 60 * 60 - 小时 1 * 3600 - 分钟 * 60); <BR>var cc = document.getElementById(divname); <BR>//如果结束时间为负数就显示0 <BR>if (leftTime > 0) { <BR>cc.innerHTML = hour "小时" 分钟"分" Second "秒"; <BR>//如果显示年份取消注释<BR>//cc.innerHTML = "距离"year "年"month "月"day"日还有:"hour"小时"min"分"second"秒"; <BR>} <BR>else { <BR>cc.innerHTML = 0 "小时" 0 "分" 0 "秒"; <BR>} <BR>} <BR>//showData是DIV的ID 2010,8,10表示是年月日的意思参数根据自己的需求设置。 <BR>window.setInterval(function () { ShowCountDown( 2010, 8, 10, 'showData'); }, 间隔); <BR></脚本> <br> </div> <br>在需要显示时间的位置加上如下代码:<br><div class="codetitle"> <span><a style="CURSOR: pointer" data="56552" class="copybut" id="copybut56552" onclick="doCopy('code56552')"><u>复制代码</u></a></span>代码如下:</div> <div class="codebody" id="code56552"> <br><div id="showData"> <br></div> <br> </div>