카운트 다운 소스(정해진날)
<html>
<head>
<title>카운트 다운</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<SCRIPT LANGUAGE="JavaScript">
<!--
function getTime() {
now = new Date();
later = new Date("JANUARY 01 2004 0:00:01"); //완료시간 지정 - 월 일 년 시 분 초
days = (later - now) / 1000 / 60 / 60 / 24;
daysRound = Math.floor(days);
hours = (later - now) / 1000 / 60 / 60 - (24 * daysRound);
hoursRound = Math.floor(hours);
minutes = (later - now) / 1000 /60 - (24 * 60 * daysRound) - (60 * hoursRound);
minutesRound = Math.floor(minutes);
seconds = (later - now) / 1000 - (24 * 60 * 60 * daysRound) - (60 * 60 * hoursRound) - (60 * minutesRound);
secondsRound = Math.round(seconds);
if (secondsRound <= 9) {
s1.innerHTML = "0";
s2.innerHTML = secondsRound;
} else {
s1.innerHTML = Math.floor(secondsRound/10);
s2.innerHTML = secondsRound%10;
}
if (minutesRound <= 9) {
m1.innerHTML = "0";
m2.innerHTML = minutesRound;
} else {
m1.innerHTML = Math.floor(minutesRound/10);
m2.innerHTML = minutesRound%10;
}
if (hoursRound <= 9) {
h1.innerHTML = "0";
h2.innerHTML = hoursRound;
} else {
h1.innerHTML = Math.floor(hoursRound/10);
h2.innerHTML = hoursRound%10;
}
if (daysRound <= 9) {
d1.innerHTML = "0";
d2.innerHTML = "0";
innerHTML = daysRound;
}
if (daysRound <= 99) {
d1.innerHTML = "0";
d2.innerHTML = Math.floor((daysRound/10)%10);
d3.innerHTML = Math.floor(daysRound%10);
}
if (daysRound <= 999) {
d1.innerHTML = Math.floor(daysRound/100);
d2.innerHTML = Math.floor((daysRound/10)%10);
d3.innerHTML = Math.floor(daysRound%10);
}
newtime = window.setTimeout("getTime();", 1000);
}
//-->
</script>
</head>
<BODY onLoad="getTime()">
<center>
<b>새해가 얼마나 남았나요?</b>
<br><br>
<font id="d1">0</font>
<font id="d2">0</font>
<font id="d3">0</font>일
<font id="h1">0</font>
<font id="h2">0</font>시간
<font id="m1">0</font>
<font id="m2">0</font>분
<font id="s1">0</font>
<font id="s2">0</font>초
</body>
</html>
'컴퓨터-유용한팁 > 스크립트' 카테고리의 다른 글
견적서 총 합계 구하는 방법 (0) | 2015.09.07 |
---|---|
링크 마우스 오버시 그라디언트효과 (0) | 2015.09.07 |
상태바에 글씨 써졌다,지워졌다 (0) | 2015.09.07 |
플래시를 랜덤하게 나타내기 (0) | 2015.09.07 |
이미지 싸이즈대로 새창띄우고 클릭하면 창닫기 (0) | 2015.09.07 |