1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
function fctTestDate(strDat)
{
if ((strDat==null)||(strDat=='')) return true
else
{
Exp = new RegExp("^\\d{2}/\\d{2}/\\d{4}$", "g");
if (Exp.test(strDat))
{
intDay = parseInt(strDat.substring(0,2));
intMonth = parseInt(strDat.substring(3,5));
alert(strDat.substring(3,5))
alert(intMonth)
if (intMonth<=12)
{
switch (intMonth)
{
case 1 :
case 3 :
case 5 :
case 7 :
case 8 :
case 10 :
case 12 :
if (intDay<=31) return true;
else return false;
break;
case 4 :
case 6 :
case 9 :
case 11 :
if (intDay<=30) return true;
else return false;
break;
case 2:
if (intDay<=29) return true;
else return false;
break;
}
}
else return false
}
else return false
}
} |