alert("请输入正确的日期格式!,例如:2009-01-01。\r\n 或从时间列表中选择日期。); 
// 没有结束冒号!改为
alert("请输入正确的日期格式!,例如:2009-01-01。\r\n 或从时间列表中选择日期。"); 

解决方案 »

  1.   

     alert("请输入正确的日期格式!,例如:2009-01-01。\r\n 或从时间列表中选择日期。); 
    这一行没有结束字符串
      

  2.   

    alert("请输入正确的日期格式!,例如:2009-01-01。\r\n 或从时间列表中选择日期。"); 是这个问题,LZ就晕掉去吧!
      

  3.   

    脚本错主要是丢了冒号!
    正则可以用,但似乎也不太正确。
    L@_@K
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
     <head>
      <title> new document </title>
      <meta name="generator" content="editplus" />
      <meta name="author" content="" />
      <meta name="keywords" content="" />
      <meta name="description" content="" />
    <script language="javascript" type="text/javascript"> 
    function checkDate() 

    var strDate = document.getElementById("txtStrDate").value;
    // 这个正则只能匹配以 1800-1999 开头滴东东,不一定是日期噢!
    var result=strDate.match(/^1[8-9]\d{2}/); 

    if(result==null) 

      //  提示信息末尾滴冒号丢了,已补上!
      alert("请输入正确的日期格式!,例如:2009-01-01。\r\n 或从时间列表中选择日期。"); 

    else 

    alert("符合您的要求"); 

    }
    </script>
     </head> <body>
     <input type="text" id="txtStrDate" value="1989haha" />
     <input type="button" value="check date" onclick="checkDate();" /> </body>
    </html>
      

  4.   

    调试通过!
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
     <head>
      <title> new document </title>
      <meta name="generator" content="editplus" />
      <meta name="author" content="" />
      <meta name="keywords" content="" />
      <meta name="description" content="" />
     </head> <body>
      <script type="text/javascript">    function checkDate() 
      { 
            var strDate = document.getElementById("txtStrDate").value; 

            var result=strDate.match(/^1[8-9]\d{2}/); 
            
            if(result==null) 
            { 
              alert("请输入正确的日期格式!,例如:2009-01-01。\r\n 或从时间列表中选择日期。"); 
            } 
            else 
            { 
                alert("符合您的要求"); 
            } 
      } 
        </script> <input id="txtStrDate" type="text" value="123" /><input id="btn" type="button" value="验证" onclick="checkDate() " />
     </body>
    </html>