http://expert.csdn.net/Expert/topic/2960/2960478.xml?temp=.4676782

解决方案 »

  1.   

    <script>
    date1 = "2004-05-03"; //入住时间
    date2 = "2004-02-11"; //离店时间
    now = Date(); //现在时间
    s1 = Date.parse(date1.replace("-","/"));
    s2 = Date.parse(date2.replace("-","/"));
    s3 = Date.parse(now);
    if (s1>s2 || s1>s3)
      alert("输入有误");
    </script>
      

  2.   

    <script language="javascript">
    function a(s1,s2)
    {
          d1 = new Date(s1);
      d1 = d1.getTime();
      d2 = new Date(s2);
      d2 = d2.getTime();
          return d2>d1
    }
    </script>
    日期格式:MM/DD/YYYY
    <br>
    Start:<input type=text name="txt1">
    <br>
    End:<input type=text name="txt2">
    <br>
    <input type=button onclick="alert(a(document.all.txt1.value,document.all.txt2.value))"
    value="Test">
      

  3.   

    <script>
    function check(date1,date2)
    {
        now = Date(); //现在时间
        s1 = Date.parse(date1.replace("-","/"));
        s2 = Date.parse(date2.replace("-","/"));
        s3 = Date.parse(now);
        if (s1>s2 || s1>s3)
        {
           alert("输入有误");
           return false;
        }
        return true;
    }
    </script>
    Start:<input type=text name="txt1">
    <br>
    End:<input type=text name="txt2">
    <br>
    <input type=button onclick="check(txt1.value,txt2.value)"
    value="Test">
      

  4.   


    towanghr100(灰豆宝宝.net) 那若是true就不要弹出窗口呀。
    要怎么改呀。thanks
      

  5.   

    onclick="return a(txt1.value,txt2.value)"