js 判断时间是否过期

<html><head></head><body><scriptlanguage="LiveScript"><!--HidingdocStarted=newDate(12... <html>
<head>
</head>
<body>
<script language="LiveScript">
<!-- Hiding
docStarted = new Date(12,0,18)
document.write("<br>过期日期: ", docStarted.getMonth()+1,"/",docStarted.getDate(),"/",docStarted.getYear());
// end hiding contents -->
</script>
<script language="LiveScript">
<!-- Hiding
today = new Date()
document.write("<br>现 在 时 间 是: ",today.getHours(),":",today.getMinutes())
document.write("<br>今 天 日 期 为: ", today.getMonth()+1,"/",today.getDate(),"/",today.getYear());
// end hiding contents -->
</script>
<br>
</body>
</html>
目的是设计一个10天后弹出个提示框说东西过期了。这个的判断如何写。。
展开
 我来答
stlr2008
2012-01-18 · TA获得超过500个赞
知道小有建树答主
回答量:568
采纳率:0%
帮助的人:400万
展开全部
你的代码我没看,说下我的思路,你把日期格式转换一下,能比较大小,如果你的当前日期比过期时间靠后,也就是大,那么就说明过期了。
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
1989yuanlina
2012-01-18
知道答主
回答量:58
采纳率:0%
帮助的人:26.9万
展开全部
调用getTime()来比较
if(docStarted .getTime()< today .getTime()){
alert("过期");
}
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 1条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式