JS 正则 时间验证
图老师小编精心整理的JS 正则 时间验证希望大家喜欢,觉得好的亲们记得收藏起来哦!您的支持就是小编更新的动力~
function CheckTime()
{
var checkValue = new RegExp ("^[0-2]{1}[0-6]{1}:[0-5]{1}[0-9]{1}:[0-5]{1}[0-9]{1}") ;
var stControl = document.getElementById("txtStartTime") ;
var stValue = stControl.value ;
if (stValue == "")
{
alert("请填写开始时间") ;
return false ;
}
if (!(checkValue.test(stValue)))
{
alert("请填写公司内部规定时间") ;
return false ;
}
var etControl = document.getElementById("txtEndTime") ;
var etValue = etControl.value ;
if (etValue == "")
{
alert("请填写结束时间") ;
return false ;
}
if (!(checkValue.test(etValue)))
{
alert("请填写公司内部规定时间") ;
return false ;
}
return true ;
}


