This article describes the implementation of pure JSP countdown dynamic display effect code. Share to everyone for your reference, specific as follows:
<%@ page language= "java" import= "java.util.*" pageencoding= "UTF-8"%> <div id=
"Showtimes" ></div >
<%
long Current_time=system.currenttimemillis ();
Long end_time=1337875200000l;
Long Time=end_time-current_time;
%>
<script>
var second = <%= time/1000%>;//number of seconds//
write a method to set the number of seconds for days
var todays = function () {
var s = second% 60;//sec
var mi = (second-s)/60 60;//min
var h = ((second-s)/60-mi)/60 % 24; Hours
var d = (((second-s)/60-mi)/60-h)/24//day return
"remaining:" + D + "days" + H + "hours" + mi + "min" + S + "seconds";
}
Then write a timer
window.setinterval (function () {
second-;
document.getElementById ("Showtimes"). InnerHTML = Todays ();
}, 1000);
</script>
I hope this article will help you with JSP program design.