求教JS中日期比较问题!~ 我从From表单中回去一个yyyy-MM-dd格式的日期,要与在JS中用NEW DATE()方法获得的日期比较!~~在网上找了些方法,感觉都不太好!~~~所以来请教了哈!~~· 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 var i = "1999-10-10"; alert((new Date() - new Date(i))>0); var validUntil = document.noticeInfoForm.elements["obj.validUntil"].value; alert(new Date(validUntil));提示NAN,我直接alert(validUntil)是有日期的!~~~ var i = "2010-11-10";var str = i.split("-");alert(new Date() - new Date(str[0], str[1]-1, str[2])); Date.prototype.CompareOther = function(other) { return this.getYear() > other.getYear() ? 1 : (this.getYear() < other.getYear() ? -1 : (this.getMonth() > other.getMonth() ? 1 : (this.getMonth() < other.getMonth() ? -1 : (this.getDate() > other.getDate() ? 1 : (this.getDate() < other.getDate() ? -1 : 0))))); } window.onload = function() { var d = new Date(); var i = "2010-11-10"; var str = i.split("-"); alert(d.CompareOther(new Date(str[0], str[1] - 1, str[2]))); } 可以稍微解释下吗,兄台!~~CompareOther()收尾的}有警告是为什么呢0 0!~~~ 鼠标移动显示内容问题? jquery的小问题 关于onsubmit的问题 求高手指教 怎么把此段代码里的按时间排序,改成按上面的 意见建议 广告申请排列显示 sina微博登陆的问题 javastript 隐藏与显示 一个变量定义的问题,高手请进. 在iframe如何实现记录下焦点光标的位置然后再恢复? 如何得到表格的所有行数??? table每行指定个数列 js文件怎么包含另一个js文件? js问题 大家帮帮忙
alert((new Date() - new Date(i))>0);
alert(new Date(validUntil));
提示NAN,我直接alert(validUntil)是有日期的!~~~
var str = i.split("-");
alert(new Date() - new Date(str[0], str[1]-1, str[2]));
return this.getYear() > other.getYear() ? 1 :
(this.getYear() < other.getYear() ? -1 :
(this.getMonth() > other.getMonth() ? 1 :
(this.getMonth() < other.getMonth() ? -1 :
(this.getDate() > other.getDate() ? 1 :
(this.getDate() < other.getDate() ? -1 : 0)))));
}
window.onload = function() {
var d = new Date();
var i = "2010-11-10";
var str = i.split("-");
alert(d.CompareOther(new Date(str[0], str[1] - 1, str[2])));
}
CompareOther()收尾的}有警告是为什么呢0 0!~~~