# 一个用JS做的剩余时间表

1235人阅读 评论(0)

js文件,是一个函数

function JSTime(vYear,vMonth,vDate,vHour,vMinute,vSecond, vState)
{
if (vState == 0)
{
//设置过期日期
var expireDate = new Date(vYear,vMonth-1,vDate,vHour,vMinute,vSecond);
//设置当前日期
var thisTime = new Date();
//总计剩余时间(毫秒)
var remainTime = expireDate-thisTime;
if(remainTime>0){
var remainDay,remainHour,remainMinute,remainSecond;
remainDay = Math.floor(remainTime/1000/3600/24);
remainTime = remainTime - (remainDay*1000*3600*24);
remainHour = Math.floor(remainTime/1000/3600);
remainTime = remainTime - (remainHour*1000*3600);
remainMinute = Math.floor(remainTime/1000/60);
remainTime = remainTime - (remainMinute*1000*60);
remainSecond = Math.floor(remainTime/1000);
remainTime = remainDay+"天"+remainHour+"小时"+remainMinute+"分"+remainSecond+"秒";
document.all["time"].innerHTML =remainTime;
}
else
document.all["time"].innerHTML ="竞拍结束";
}
else
if (vState == 1)
{
document.all["time"].innerHTML ="竞拍结束";
}
else
document.all["time"].innerHTML ="竞拍结束";
}

<%

tempt=rs("aucclosedate")

bbryear=year(tempt)
bbrmonth=month(tempt)
bbrday=day(tempt)
bbrhour=hour(tempt)
bbrminute=minute(tempt)
bbrsecond=second(tempt)if bbrstate="N" then
bbrstate=0
else
bbrstate=1
end if

Response.Write"<script>setInterval('JSTime("& bbryear &", "& bbrmonth &", "& bbrday &", "& bbrhour &", "& bbrminute &", "& bbrsecond &", "& bbrstate &")',1000);</script>" & vbcrlf

Response .Write "                    <tr> " & vbcrlf
Response .Write "                       <td height=22>剩余时间： <span id=time>正在计算...</span></td>" & vbcrlf
Response .Write "                      </tr>" & vbcrlf
%>

0
0

* 以上用户言论只代表其个人观点，不代表CSDN网站的观点或立场
个人资料
• 访问：412607次
• 积分：5392
• 等级：
• 排名：第4947名
• 原创：92篇
• 转载：240篇
• 译文：0篇
• 评论：36条
最新评论