页面倒计时
来源:互联网 发布:apache shiro文档 编辑:程序博客网 时间:2024/04/29 16:57
<%
//秒杀倒计时
String sDt = "05/27/2013 21:00:00";
SimpleDateFormat sdf= new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
Date dt2 = sdf.parse(sDt);
long beginTime = dt2.getTime();
%>
<script language="javascript">
setTimeout("show_time()",1000);
function show_time()
{
var time_distance,str_time;
var int_day,int_hour,int_minute,int_second;
var time_now=new Date();
time_now=time_now.getTime(); //取系统现在时间
time_distance=timeForm.time_begin.value-time_now;
//时间间隔。timeForm.time_end.value是竞拍商品的到期时间
if(time_distance>0)
{
//取出间隔时间的天、小时、分,java中时间换成毫秒是按照1000*60*60*24这样的换算方式转的
int_day=Math.floor(time_distance/86400000)
time_distance-=int_day*86400000;
int_hour=Math.floor(time_distance/3600000)
time_distance-=int_hour*3600000;
int_minute=Math.floor(time_distance/60000)
time_distance-=int_minute*60000;
int_second=Math.floor(time_distance/1000)
if(int_hour<10)
int_hour="0"+int_hour;
if(int_minute<10)
int_minute="0"+int_minute;
if(int_second<10)
int_second="0"+int_second;
str_time=int_day+"天<br>"+int_hour+":"+int_minute+":"+int_second;
hour.innerHTML=int_hour;
minute.innerHTML=int_minute;
second.innerHTML=int_second;
timer.innerHTML=str_time;
setTimeout("show_time()",1000); //循环调用
}else
{
timer.innerHTML ="over";
clearTimeout(timerID)
}
}
</script>
<form name="timeForm">
<input type="hidden" name="time_begin" value="<%=beginTime %>" />
<tr>
<td>
<div align="center">剩余时间</div>
</td>
<td class="time">
<div id="timer"></div>
</td>
</tr>
</form>
//秒杀倒计时
String sDt = "05/27/2013 21:00:00";
SimpleDateFormat sdf= new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
Date dt2 = sdf.parse(sDt);
long beginTime = dt2.getTime();
%>
<script language="javascript">
setTimeout("show_time()",1000);
function show_time()
{
var time_distance,str_time;
var int_day,int_hour,int_minute,int_second;
var time_now=new Date();
time_now=time_now.getTime(); //取系统现在时间
time_distance=timeForm.time_begin.value-time_now;
//时间间隔。timeForm.time_end.value是竞拍商品的到期时间
if(time_distance>0)
{
//取出间隔时间的天、小时、分,java中时间换成毫秒是按照1000*60*60*24这样的换算方式转的
int_day=Math.floor(time_distance/86400000)
time_distance-=int_day*86400000;
int_hour=Math.floor(time_distance/3600000)
time_distance-=int_hour*3600000;
int_minute=Math.floor(time_distance/60000)
time_distance-=int_minute*60000;
int_second=Math.floor(time_distance/1000)
if(int_hour<10)
int_hour="0"+int_hour;
if(int_minute<10)
int_minute="0"+int_minute;
if(int_second<10)
int_second="0"+int_second;
str_time=int_day+"天<br>"+int_hour+":"+int_minute+":"+int_second;
hour.innerHTML=int_hour;
minute.innerHTML=int_minute;
second.innerHTML=int_second;
timer.innerHTML=str_time;
setTimeout("show_time()",1000); //循环调用
}else
{
timer.innerHTML ="over";
clearTimeout(timerID)
}
}
</script>
<form name="timeForm">
<input type="hidden" name="time_begin" value="<%=beginTime %>" />
<tr>
<td>
<div align="center">剩余时间</div>
</td>
<td class="time">
<div id="timer"></div>
</td>
</tr>
</form>
- 页面倒计时
- 页面倒计时
- 页面倒计时
- 页面倒计时
- 倒计时页面
- 倒计时跳转页面
- 页面中自动倒计时
- 页面时钟倒计时
- 常用的页面倒计时
- javascript时间页面倒计时
- 倒计时页面跳转
- 页面跳转倒计时
- 倒计时提交页面
- js倒计时跳转 页面
- 倒计时自动跳转页面
- JSP页面时间倒计时
- jsp倒计时 页面跳转
- JSP页面倒计时
- Eclipse安装插件长时间停留在calculating requirements and dependencies
- 数据库优化方案
- 如果把谷歌数据中心的数据都用打孔卡存起来
- 遍历vector容器的效率问题
- fedora中android环境的安装
- 页面倒计时
- shell 学习笔记(一)
- 数据持久化之.plist文件
- xstream java 转换为xml
- A potentially dangerous Request.Form value was detected from the client
- 计算机系统原理之程序是怎么运行的
- App Store Review Guidelines
- 2013 ACM/ICPC 南京网络赛 1002 - Parade Show
- 整除运算, 写一个程序,接收两个整数a和b,关判断a是否能被b整除,输出判断结果