남은시간 카운트하는 자바스크립트
<SCRIPT language=JavaScript>
function getTime() {
now = new Date();
dday = new Date(2013,02,14,18,00,00);
// 원하는 날짜, 시간 정확하게 초단위까지 기입.
days = (dday - now) / 1000 / 60 / 60 / 24;
daysRound = Math.floor(days);
hours = (dday - now) / 1000 / 60 / 60 - (24 * daysRound);
hoursRound = Math.floor(hours);
minutes = (dday - now) / 1000 /60 - (24 * 60 * daysRound) - (60 * hoursRound);
minutesRound = Math.floor(minutes);
seconds = (dday - now) / 1000 - (24 * 60 * 60 * daysRound) - (60 * 60 * hoursRound) - (60 * minutesRound);
secondsRound = Math.round(seconds);
document.getElementById("counter1").innerHTML = hoursRound;
document.getElementById("counter2").innerHTML = minutesRound;
document.getElementById("counter3").innerHTML = secondsRound;
newtime = window.setTimeout("getTime();", 1000);
}
</SCRIPT>
<STYLE type=text/css>
/*타임*/
#count {
height: 167px;
color: #000;
padding-left: 100px;
padding-top:130px;
background-image: url(http://www.bb.co.kr/data/201302/IJ13607483252985/12.jpg);
background-repeat: no-repeat;
}
#bt {
height: 16px;
width: 49;
padding-left: 100px;
padding-top: 0px;
}
</STYLE>
<TABLE cellSpacing=0 cellPadding=0>
<TBODY>
<TR>
<TD height=167 width=256>
<DIV id=count><SPAN style="FONT: bold 12px Gulim; COLOR: #000" id=counter1></SPAN><FONT style="FONT-FAMILY: '굴림'; size: 7px">시간</FONT> <SPAN style="FONT: bold 12px Gulim; COLOR: #000" id=counter2></SPAN><FONT style="FONT-FAMILY: '굴림'; size: 7px">분</FONT> <SPAN style="FONT: bold 12px Gulim; COLOR: #000" id=counter3></SPAN><FONT style="FONT-FAMILY: '굴림'; size: 7px">초 남음</FONT>
<SPAN style="padding-left:30px;"></SPAN></div>
</TD></TR></TBODY></TABLE>
<SCRIPT>getTime()</SCRIPT>
댓글 1개
게시판 목록
개발자팁
질문은 QA에서 해주시기 바랍니다.
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 116 | MySQL | 20년 전 | 5876 | ||
| 115 | PHP | 20년 전 | 5419 | ||
| 114 | MySQL | 20년 전 | 6568 | ||
| 113 | 기타 | 20년 전 | 15264 | ||
| 112 | 기타 | 20년 전 | 4527 | ||
| 111 | 기타 | 20년 전 | 5208 | ||
| 110 | 기타 | 20년 전 | 4787 | ||
| 109 | 기타 | 20년 전 | 4377 | ||
| 108 | 기타 | 20년 전 | 4218 | ||
| 107 | JavaScript | 20년 전 | 4446 | ||
| 106 | 기타 | 20년 전 | 4323 | ||
| 105 | MySQL |
|
20년 전 | 4893 | |
| 104 | 기타 | 20년 전 | 7087 | ||
| 103 | 기타 | 20년 전 | 5703 | ||
| 102 | JavaScript | 21년 전 | 7988 | ||
| 101 | 기타 | 21년 전 | 10110 | ||
| 100 | 기타 | 21년 전 | 24895 | ||
| 99 | PHP | 21년 전 | 8946 | ||
| 98 | MySQL | 21년 전 | 4957 | ||
| 97 | 기타 | 21년 전 | 5825 | ||
| 96 | JavaScript |
prosper
|
21년 전 | 3901 | |
| 95 | PHP |
prosper
|
21년 전 | 5859 | |
| 94 | 기타 |
아우겐나이스
|
21년 전 | 4475 | |
| 93 | 기타 | 21년 전 | 4119 | ||
| 92 | 기타 | 21년 전 | 3813 | ||
| 91 | 기타 | 21년 전 | 3925 | ||
| 90 | JavaScript | 21년 전 | 4987 | ||
| 89 | 기타 | 21년 전 | 3687 | ||
| 88 | 기타 | 21년 전 | 3243 | ||
| 87 | 기타 | 21년 전 | 3457 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기