天天看点

Date.parse Firefox返回Nan的解决办法

不知何故,firefox对于类似“2010-12-20 15:55:00”这种时间的转换格式不感冒,返回nan,查了查资料,把“-”替换为“/”就可以了;

<mce:script type="text/javascript"><!--

var inputdate="2010-12-20 15:55:00";

inputdate=inputdate.replace("-", "/").replace("-", "/");

var nowdate=new date();

//alert(date.parse(inputdate))

//alert(date.parse(nowdate))

if(date.parse(inputdate)<date.parse(nowdate))

{

alert("对不起,输入时间不能晚于当前时间!");

}

// --></mce:script>  

继续阅读