Jsp countdown code tutorial, jsp countdown code tutorial

Source: Internet
Author: User

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 );  

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.