js 验证日期格式

        function CheckDateFormat(_value) {
            //var a = /^(\d{4})-(\d{2})-(\d{2})$/;
            // var a = /^(\d{4})(-|\/)(\d{2})(-|\/)(\d{2})$/;
            var a = /^(\d{4})(\/)(\d{2})(\/)(\d{2})$/;
            if (!a.test(_value)) {
                // alert("日期格式不正确!")

                alert("Incorrect date format.");
                return false
            }
            else
                return true
        }

  

posted @ 2013-03-25 10:09  汉城  阅读(246)  评论(0编辑  收藏  举报