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" >
-
<style type="text/css">
+
<head><title></title>
-
 
+
    <script type="text/javascript">
-
input
+
        var strDate = "2009-07-18"; //여기에 목표가 되는 날짜(연-월-일)을(를) 입력합니다.
-
{
+
        var strTime = "23:59:00";     //여기에 목표가 되는 시간(시:분:초)을(를) 입력합니다.
-
width:30px;
+
        var arrDate = strDate.split("-");
-
text-align:center;
+
        var arrTime = strTime.split(":");
-
}
+
        var arrMonth = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
-
 
+
     
-
</style>
+
         function Dday_countdown(){
-
 
+
            var now = new Date();
-
<script type="text/javascript">
+
            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 arrDate = new Array(2011, 11, 08);
+
            var nHour = now.getHours();
-
var arrTime = new Array(0,0,0);
+
            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 now = new Date();
+
             var d_date = Date.parse(strfuture) - Date.parse(strnow);
-
            var nYear = now.getYear();
+
         
-
            var nMonth = now.getMonth();
+
            d_day = Math.floor(d_date / 86400000);
-
            var nDay = now.getDate();
+
            d_hour = Math.floor((d_date % 86400000) / 3600000);
-
            var nHour = now.getHours();
+
            d_min = Math.floor(((d_date % 86400000) % 3600000) / 60000);
-
            var nMin = now.getMinutes();
+
            d_sec = Math.floor((((d_date % 86400000) % 3600000) % 60000) / 1000);
-
            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 strfuture = arrMonth[arrDate[1] - 1] + " " + (arrDate[2] + 1) + ", " + arrDate[0] + " " + arrTime[0] + ":" + arrTime[1] + ":" + arrTime[2];
+
-
              
+
-
            var d_date = Date.parse(strfuture) - Date.parse(strnow);
+
   
   
-
            d_day = Math.floor(d_date / 86400000);
+
            var oTimeCnt = document.getElementById("Timecount");
-
            stmp = String(Math.floor((d_date % 86400000) / 3600000));
+
            if (d_day <= 0 && d_hour <= 0 && d_min <= 0 && d_sec <= 1 && nDay == arrDate[1]) oTimeCnt.innerHTML = "D-Day 입니다.";
-
            d_hour = stmp.length == 1 ? "0" + stmp : stmp;
+
            else if (d_day <= -1) oTimeCnt.innerHTML = Math.abs(d_day) + "일 " + Math.abs(d_hour) + "시간 " + Math.abs(d_min) + "분 " + Math.abs(d_sec) + "초 지났습니다.! ";
-
            stmp = String(Math.floor(((d_date % 86400000) % 3600000) / 60000));
+
            else oTimeCnt.innerHTML = d_day + "" + d_hour + "시간 " + d_min + "분 " + d_sec + "초 남았습니다.";
-
            d_min = stmp.length == 1 ? "0" + stmp : stmp;
+
-
            stmp = String(Math.floor((((d_date % 86400000) % 3600000) % 60000) / 1000));
+
-
            d_sec = stmp.length == 1 ? "0" + stmp : stmp;
+
   
   
-
            var sDate = arrDate[0] + "년" + arrDate[1] + "월" + arrDate[2] + "일 까지 ";
+
             setTimeout("Dday_countdown()", 1000);
-
              
+
-
            var oTimeCnt = document.getElementById("Timecount");
+
-
           
+
-
            oTimeCnt.innerHTML = d_day + "일" + d_hour + "시" + d_min + "분" + d_sec + "초 남았습니다.";
+
   
   
-
            setTimeout("Dday_countdown()", 10);
+
        }
-
        }
+
        window.onload = Dday_countdown;
-
        window.onload = Dday_countdown;
+
    </script>
-
    </script>
+
</head>
-
</head>
+
<body>
-
<body>
+
<div id="Timecount"></div>
-
<div style="width:400px; text-align:center; font-size:15px; font-family:@맑은 고딕" id="Timecount"></div>
+
</body>
-
</body>
+
</html>
-
</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">