JS的倒计时问题
2个回答
展开全部
<Script Language="JavaScript">
var timedate= new Date("2011/9/10");
var times="";
var now = new Date();
var date = timedate.getTime() - now.getTime();
var cdate = now.getTime() - timedate.getTime();
var time = Math.floor(date / (1000 * 60 * 60 * 24)+1);
var ctime = Math.floor(cdate / (1000 * 60 * 60 * 24));
if (time >= 0){
document.write("<b>"+time +"</b>天");
}
else{
document.write("<font color=red><b>过期"+ctime +"</b>天</font>");
}
</Script>
var timedate= new Date("2011/9/10");
var times="";
var now = new Date();
var date = timedate.getTime() - now.getTime();
var cdate = now.getTime() - timedate.getTime();
var time = Math.floor(date / (1000 * 60 * 60 * 24)+1);
var ctime = Math.floor(cdate / (1000 * 60 * 60 * 24));
if (time >= 0){
document.write("<b>"+time +"</b>天");
}
else{
document.write("<font color=red><b>过期"+ctime +"</b>天</font>");
}
</Script>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询