<script type="text/javascript"> //mydate yyyy-MM-dd 格式 function CompareWithTody(mydate) { var stoday = new Date(); var syear =Number(stoday.getYear().toString()); //在firefox下得再加1900 var smonth = (stoday.getMonth()+1).toString(); var sday = stoday.getDate().toString(); if(smonth.length == 1) { smonth = "0"+smonth; } if(sday.length == 1) { sday = "0"+sday; } var strToday = syear+"\/"+smonth+"\/"+sday; var d1=new Date(Date.parse(mydate));//转化成日期格式以后,再进行比较 var d2=new Date(Date.parse(strToday)); return d1>d2
} </script>
如对本文有疑问,请提交到交流论坛,广大热心网友会为你解答!! 点击进入论坛