SoFunction
Updated on 2025-04-07

Complete code for countdown dynamic display effect of pure jsp implementation

This article describes the countdown dynamic display effect code of pure JSP implementation. Share it for your reference, as follows:

<%@ page language="java" import=".*" pageEncoding="UTF-8"%>
<div ></div>
<%
 long current_time=();
 long end_time=1337875200000l;
 long time=end_time-current_time;
 %>
<script>
var second = <%= time / 1000%>; // The remaining seconds// Write a method to specify the number of seconds to daysvar toDays = function(){
 var s = second % 60; // Second var mi = (second - s) / 60 % 60; // minute var h = ((second - s) / 60 - mi ) / 60 % 24; // Hour var d = (((second - s) / 60 - mi ) / 60 - h ) / 24 // skyreturn "Remaining:" + d + "sky" + h + "Hour" + mi + "minute" + s + "Second";
}
// Then write a timer(function(){
 second --;
 ("showTimes").innerHTML = toDays ();
}, 1000);
</script>

I hope this article will be helpful to everyone's JSP programming.