Jsp countdown code tutorial, jsp countdown code tutorial
Jsp:
<Section> <B class = "day" id = "d"> 10 </B> days <B class = "hour" id = "h"> 5 </B> hour <B class = "minute" id = "m"> 5 </B> minutes <B class = "second" id = "s"> 5 </B> seconds </section> <script type = "text/javascript"> $ (document ). ready (xc); function xc () {var js_date =$ {starttime}; // the end time can be read from the database var now_date = new Date (). getTime (); xc_day = parseInt (js_date-now_date)/1000/60/60/24); xc_h = parseInt (js_date-now_date)/1000/60/60-24 * xc_day ); xc_m = parseInt (js_date-now_date)/1000/60 -xc_day * 24 * 60-xc_h * 60); xc_s = parseInt (js_date-now_date) /1000-xc_m * 60-xc_h * 60 * 60-xc_day * 24*60*60); document. getElementById ("d "). innerHTML = xc_day; document. getElementById ("h "). innerHTML = xc_h; document. getElementById ("m "). innerHTML = xc_m; document. getElementById ("s "). innerHTML = xc_s; setTimeout ("xc ()", 1000) ;}</script>
Java:
Long starttime = selectionCycle.getStart_time().getTime(); ServletActionContext.getRequest().setAttribute("starttime ",starttime );