Team:KAIST-Korea/Test Count
From 2011.igem.org
(Difference between revisions)
Line 1: | Line 1: | ||
<html xmlns="http://www.w3.org/1999/xhtml" > | <html xmlns="http://www.w3.org/1999/xhtml" > | ||
- | <head> | + | <head><title></title> |
- | <title> | + | |
- | </title> | + | |
- | + | ||
<style type="text/css"> input { width:30px; text-align:center } </style> | <style type="text/css"> input { width:30px; text-align:center } </style> | ||
<script type="text/javascript"> | <script type="text/javascript"> | ||
var arrMonth = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"); | var arrMonth = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"); | ||
- | var arrDate = new Array( | + | var arrDate = new Array(2009, 12, 25); //목표 날짜를 입력하세요 |
var arrTime = new Array(0, 0, 0); | var arrTime = new Array(0, 0, 0); | ||
Line 17: | Line 14: | ||
var nHour = now.getHours(); | var nHour = now.getHours(); | ||
var nMin = now.getMinutes(); | var nMin = now.getMinutes(); | ||
+ | var nSec = now.getSeconds(); | ||
+ | var stmp = String(now.getMilliseconds()); | ||
+ | var nmSec = (stmp.length == 1 ? "00" + stmp : stmp.length == 2 ? "0" + stmp : stmp); | ||
var strnow = arrMonth[nMonth] + " " + nDay + ", " + nYear + " " + nHour + ":" + nMin + ":" + nSec; | var strnow = arrMonth[nMonth] + " " + nDay + ", " + nYear + " " + nHour + ":" + nMin + ":" + nSec; | ||
var strfuture = arrMonth[arrDate[1] - 1] + " " + (arrDate[2] + 1) + ", " + arrDate[0] + " " + arrTime[0] + ":" + arrTime[1] + ":" + arrTime[2]; | var strfuture = arrMonth[arrDate[1] - 1] + " " + (arrDate[2] + 1) + ", " + arrDate[0] + " " + arrTime[0] + ":" + arrTime[1] + ":" + arrTime[2]; | ||
Line 22: | Line 22: | ||
var d_date = Date.parse(strfuture) - Date.parse(strnow); | var d_date = Date.parse(strfuture) - Date.parse(strnow); | ||
- | + | d_day = Math.floor(d_date / 86400000); | |
stmp = String(Math.floor((d_date % 86400000) / 3600000)); | stmp = String(Math.floor((d_date % 86400000) / 3600000)); | ||
d_hour = stmp.length == 1 ? "0" + stmp : stmp; | d_hour = stmp.length == 1 ? "0" + stmp : stmp; | ||
Line 35: | Line 35: | ||
if (d_day == 0) oTimeCnt.innerHTML = " D-Day 입니다."; | if (d_day == 0) oTimeCnt.innerHTML = " D-Day 입니다."; | ||
else if (d_day <= -1) oTimeCnt.innerHTML = Math.abs(d_day) + ":" + (String(Math.abs(d_hour)).length == 1 ? "0" + Math.abs(d_hour) : Math.abs(d_hour)) + ":" + (String(Math.abs(d_min)).length == 1 ? "0" + Math.abs(d_min) : Math.abs(d_min)) + ":" + (String(Math.abs(d_sec)).length == 1 ? "0" + Math.abs(d_sec) : Math.abs(d_sec)) + ":" + nmSec + "지났습니다."; | else if (d_day <= -1) oTimeCnt.innerHTML = Math.abs(d_day) + ":" + (String(Math.abs(d_hour)).length == 1 ? "0" + Math.abs(d_hour) : Math.abs(d_hour)) + ":" + (String(Math.abs(d_min)).length == 1 ? "0" + Math.abs(d_min) : Math.abs(d_min)) + ":" + (String(Math.abs(d_sec)).length == 1 ? "0" + Math.abs(d_sec) : Math.abs(d_sec)) + ":" + nmSec + "지났습니다."; | ||
- | else oTimeCnt.innerHTML = d_day + "일" + d_hour + "시" + d_min + "분" + d_sec + "초 남았습니다."; | + | else oTimeCnt.innerHTML = sDate + d_day + "일" + d_hour + "시" + d_min + "분" + d_sec + "초" + nmSec + "남았습니다."; |
setTimeout("Dday_countdown()", 10); | setTimeout("Dday_countdown()", 10); | ||
Line 43: | Line 43: | ||
</head> | </head> | ||
<body> | <body> | ||
- | <div style=" width:400px; text-align:center; font-size:15px; font-family:@맑은 고딕" id="Timecount"></div> | + | <div style="border:solid 1px #000000; width:400px; text-align:center; font-size:15px; font-family:@맑은 고딕" id="Timecount"></div> |
</body> | </body> | ||
</html> | </html> |
Revision as of 09:54, 8 July 2011