js date 火狐不兼容 解决办法 火狐版本25,0
<!DOCTYPE HTML> <html lang="en-US"> <head> <meta charset="UTF-8"> <title></title> <script type="text/javascript"> var value ="2013/8/9 00:00:00"; var v="2013-08-09 01:02:03"; var date = new Date(value); var date2 = new Date(v); var m=date.getMonth(); var m2=date2.getMonth(); alert(m); alert(m2); </script> </head> <body> </body> </html>
解决办法:
v.replace(/-/g, "/");