Monday, February 18, 2008

Credit Card Expiration Date Validation -Javascript Function




function ValidateExpDate()

{

var ccExpYear = 20 + $F('<%= txtCCExpirationYear.ClientID%>');

var ccExpMonth = $F('<%= txtCCExpirationMonth.ClientID%>');



var expDate=new Date();

expDate.setFullYear(ccExpYear, ccExpMonth, 1);



var today = new Date();



if (expDate<today)

{

// Credit Card is expire

return false;

}

else

{

// Credit is valid

return true;

}

}



2 comments: