<script language="JavaScript">
var a=new Date();
var b=new Date()+1;
alert(String(a)<String(b)?"yes":"no");
</script>

解决方案 »

  1.   

    var a=new Date('2003/03/03');
    var b=new Date('2003/04/05');
    if(Date.parse(a)<Date.parse(b))alert("a<b")
    else(alert(a>=b))
      

  2.   

    <SCRIPT LANGUAGE=vbscript>
    <!--
    function datevalid
      datevalid = false
      if not isdate(InputForm.date1.value) then
        msgbox "日期错误"
        exit function
      end if  if not isdate(InputForm.date2.value) then
        msgbox "日期错误"
        exit function
      end if
      
      if cdate(InputForm.date2.value) <= cdate(InputForm.date1.value) then
        msgbox "结束日期必须大于开始日期"
        exit function
      end if
      datevalid=true
    end function
    -->
    </script>