페이지에 JSP 서버 확보 시간 카운트다운으로 표시

3124 단어
 
  






Calendar cal = Calendar.getInstance();
int hour = cal.get(cal.HOUR_OF_DAY);
int minute = cal.get(cal.MINUTE);
int month = cal.get(cal.MONTH);
int date = cal.get(cal.DATE);
int year = cal.get(cal.YEAR);
int second = cal.get(cal.SECOND);
%>
<br>var NowHour = "";//Today.getHours(); <br>var NowMinute = "";//Today.getMinutes(); <br>var NowMonth = "";//Today.getMonth(); <br>var NowDate = "";//Today.getDate(); <br>var NowYear = "";//Today.getYear(); <br>var NowSecond = "";//Today.getSeconds(); <br>// <br>function getTime(){ <br>NowHour = <%=hour%>; <br>NowMinute = <%=minute%>; <br>NowMonth = <%=month%>; <br>//NowMonth = (parseInt(NowMonth)+1); <br>NowDate = <%=date%>; <br>NowYear = <%=year%>; <br>NowSecond = <%=second%>; <br>} <br>getTime(); <br>startclock(); <br>var timerID = null; <br>var timerRunning = false; <br>function showtime() { <br> <br>var time='${enddate}';// , <br>NowSecond = (parseInt(NowSecond)+1); <br>//------------------------------------------------------------------- <br>var a, a1, a2; <br>var EndTime ; <br>a = unescape('${enddate}').split(" "); // , , , 2012-12-20 。 <br>if(a.length > 1){ <br>a1 = a[0].split("-"); <br>a2 = a[1].split(":"); <br>EndTime= new Date(a1[0], a1[1] - 1, a1[2], a2[0], a2[1],a2[2]); <br>} <br>var NowTime= new Date(NowYear,NowMonth,NowDate,NowHour,NowMinute,NowSecond); <br>var nMS =EndTime.getTime() - NowTime.getTime(); <br>var nD =Math.floor(nMS/(1000 * 60 * 60 * 24)); <br>var nH=Math.floor(nMS/(1000*60*60)) % 24; <br>var nM=Math.floor(nMS/(1000*60)) % 60; <br>var nS=Math.floor(nMS/1000) % 60; <br>var dddd= nD+'-'+nH+'-'+nM+'-'+nS; <br> <br>if(nD>= 0){ <br>document.getElementById('RemainD').innerText = nD; <br>document.getElementById('RemainH').innerText = nH; <br>document.getElementById('RemainM').innerText = nM; <br>document.getElementById('RemainS').innerText = nS; <br>}else { <br>document.getElementById('CountMsg').innerText=" !"; <br>} <br>setTimeout("showtime()", 1000); <br>} <br>function startclock() { <br>showtime(); // , <br>} <br>



XX XX XX XX



좋은 웹페이지 즐겨찾기