js日期验证

    技术2022-05-11  42

    function checkDate(object)         {             var dateStr=object.value;             var matchArray = dateStr.match(/^((((1[6-9]|[2-9]/d)/d{2})-(0?[13578]|1[02])-(0?[1-9]|[12]/d|3[01]))|(((1[6-9]|[2-9]/d)/d{2})-(0?[13456789]|1[012])-(0?[1-9]|[12]/d|30))|(((1[6-9]|[2-9]/d)/d{2})-0?2-(0?[1-9]|1/d|2[0-8]))|(((1[6-9]|[2-9]/d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))-0?2-29-))$/);             if (matchArray == null)             {                 alert("出生日期格式不正确!请输入正确的格式如:【2006-01-01】或【2006-1-1】") ;                 object.focus();                 return false;             }         }  

    最新回复(0)