Javascript & JQuery & CSS > example - ½Ã°è ŸÀÌ¸Ó Ä«¿îÆ® ¿¹Á¦
µî·ÏÀÏ : 2019-10-07 11:58
Á¶È¸¼ö : 53,564
¾Æ·¡´Â ¿¹Á¦ ÆäÀÌÁö ÀÔ´Ï´Ù.
http://ankyu.entersoft.kr/lecture/jquery/jquery.timer/test.asp
<%
board_timer = now
board_timer_year = year(board_timer)
board_timer_month = Month(board_timer)-1
board_timer_day = day(board_timer)+3
board_timer_hour = Hour(board_timer)
board_timer_Minute = Minute(board_timer)
%>
<SCRIPT language=JavaScript>
function getTime() {
board_timer_year = $("#board_timer_year").val();
board_timer_month = $("#board_timer_month").val();
board_timer_day = $("#board_timer_day").val();
board_timer_hour = $("#board_timer_hour").val();
board_timer_minute = $("#board_timer_minute").val();
//alert(board_timer_year+"-"+board_timer_month+"-"+board_timer_day+" "+board_timer_hour+":"+board_timer_minute);
now = new Date();
dday = new Date(board_timer_year, board_timer_month, board_timer_day, board_timer_hour, board_timer_minute, 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("counter0").innerHTML = daysRound;
document.getElementById("counter1").innerHTML = hoursRound;
document.getElementById("counter2").innerHTML = minutesRound;
document.getElementById("counter3").innerHTML = secondsRound;
newtime = window.setTimeout("getTime();", 1000);
}
</SCRIPT>
<input type="hidden" id="board_timer_year" name="board_timer_year" value="<%=board_timer_year%>">
<input type="hidden" id="board_timer_month" name="board_timer_month" value="<%=board_timer_month%>">
<input type="hidden" id="board_timer_day" name="board_timer_day" value="<%=board_timer_day%>">
<input type="hidden" id="board_timer_hour" name="board_timer_hour" value="<%=board_timer_hour%>">
<input type="hidden" id="board_timer_minute" name="board_timer_minute" value="<%=board_timer_minute%>">
<DIV id=count>
<span> ½Åû¸¶°¨ </span>
<SPAN id=counter0></SPAN>ÀÏ
<SPAN id=counter1></SPAN>½Ã°£
<SPAN id=counter2></SPAN>ºÐ
<SPAN id=counter3></SPAN>ÃÊ ³²À½
</div>