Team:KAIST-Korea/Test Count
From 2011.igem.org
(Difference between revisions)
Line 1: | Line 1: | ||
- | <html> | + | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
- | <head> | + | <html xmlns="http://www.w3.org/1999/xhtml" > |
- | < | + | <head><title></title> |
- | + | <script type="text/javascript"> | |
- | + | var strDate = "2009-07-18"; //여기에 목표가 되는 날짜(연-월-일)을(를) 입력합니다. | |
- | + | var strTime = "23:59:00"; //여기에 목표가 되는 시간(시:분:초)을(를) 입력합니다. | |
- | + | var arrDate = strDate.split("-"); | |
- | + | var arrTime = strTime.split(":"); | |
- | + | var arrMonth = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"); | |
- | + | ||
- | + | function Dday_countdown(){ | |
- | + | var now = new Date(); | |
- | + | var nYear = now.getYear(); | |
- | + | var nMonth = now.getMonth(); | |
- | var arrMonth = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"); | + | var nDay = now.getDate(); |
- | + | var nHour = now.getHours(); | |
- | + | var nMin = now.getMinutes(); | |
- | + | var nSec = now.getSeconds(); | |
- | function Dday_countdown() | + | var strnow = arrMonth[nMonth] + " " + nDay + ", " + nYear + " " + nHour + ":" + nMin + ":" + nSec; |
- | { | + | var strfuture = arrMonth[arrDate[1] - 1] + " " + arrDate[2] + ", " + arrDate[0] + " " + arrTime[0] + ":" + arrTime[1] + ":" + arrTime[2]; |
- | + | var d_date = Date.parse(strfuture) - Date.parse(strnow); | |
- | + | ||
- | + | d_day = Math.floor(d_date / 86400000); | |
- | + | d_hour = Math.floor((d_date % 86400000) / 3600000); | |
- | + | d_min = Math.floor(((d_date % 86400000) % 3600000) / 60000); | |
- | + | d_sec = Math.floor((((d_date % 86400000) % 3600000) % 60000) / 1000); | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | var oTimeCnt = document.getElementById("Timecount"); | |
- | + | if (d_day <= 0 && d_hour <= 0 && d_min <= 0 && d_sec <= 1 && nDay == arrDate[1]) oTimeCnt.innerHTML = "D-Day 입니다."; | |
- | + | else if (d_day <= -1) oTimeCnt.innerHTML = Math.abs(d_day) + "일 " + Math.abs(d_hour) + "시간 " + Math.abs(d_min) + "분 " + Math.abs(d_sec) + "초 지났습니다.! "; | |
- | + | else oTimeCnt.innerHTML = d_day + "일 " + d_hour + "시간 " + d_min + "분 " + d_sec + "초 남았습니다."; | |
- | + | ||
- | + | ||
- | + | ||
- | + | setTimeout("Dday_countdown()", 1000); | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | } | |
- | + | window.onload = Dday_countdown; | |
- | + | </script> | |
- | + | </head> | |
- | + | <body> | |
- | + | <div id="Timecount"></div> | |
- | + | </body> | |
- | + | </html> | |
- | + |
Revision as of 10:03, 8 July 2011
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">