jsp中实现倒计时

jsp:
	<section>还有<b class="day" id="d">10</b>天<b class="hour" id="h">5</b>小时<b class="minute" id="m">5</b>分<b class="second" id="s">5</b>秒</section>

	<script type="text/javascript">
		$(document).ready(xc);
		function xc(){
 			var js_date=${starttime }; //结束时间 可以从数据库中读出来
			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 );



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

熊猫猫猫猫猫猫

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值