<div class="htmlarea"> <textarea id="runcode201"> <meta charset="utf-8"> <title>카운트다운</title> <meta name="Author" content=""> <meta name="Keywords" content=""> <meta name="Description" content=""> <style type="text/css"> *{ margin: 0; padding: 0; } ul,li{list-style: none;} #show_time{color: #f00;font-size: 24px;font-weight: bold;} </style> <div id="show_time"> </div> </textarea> <br><input onclick="runEx('runcode201')" type="button" value="运行代码"><input onclick="doCopy('runcode201')" type="button" value="复制代码"> <input onclick="doSave(runcode201)" type="button" value="保存代码"> <a href="http://www.jb51.net/article/23421.htm" title="查看具体详情" target="_blank">[Ctrl A 모두 선택 참고: </a>외부 J를 도입해야 하는 경우 실행하려면 새로 고쳐야 합니다 </div>]<script type="text/javascript"> function countdown(){ var show_time = document.getElementById("show_time"); endtime = new Date("12/31/2012 23:59:59");//结束时间 today = new Date();//当前时间 delta_T = endtime.getTime() - today.getTime();//时间间隔 if(delta_T < 0){ clearInterval(auto); show_time.innerHTML = "倒计时已经结束"; } window.setTimeout(countdown,1000); total_days = delta_T/(24*60*60*1000);//总天数 total_show = Math.floor(total_days);//实际显示的天数 total_hours = (total_days - total_show)*24;//剩余小时 hours_show = Math.floor(total_hours);//实际显示的小时数 total_minutes = (total_hours - hours_show)*60;//剩余的分钟数 minutes_show = Math.floor(total_minutes);//实际显示的分钟数 total_seconds = (total_minutes - minutes_show)*60;//剩余的分钟数 seconds_show = Math.floor(total_seconds);//实际显示的秒数 show_time.innerHTML = "距离结束还有:" + total_show + "天" + hours_show + "时" + minutes_show + "分" + seconds_show + "秒"; } countdown(); </script>