function CardNumber(num, isVisa, isMaster) {
var card = new Array();
if (document.getElementById('radioVisa').checked) {
card = isVisa;
} if (isVisa){
((isNaN(num))||(num[0] != '4') || (num.length != 16))
return false;
} else {
return true;
}
if (document.getElementById.innerHTML('radioMaster').checked) {
card = isMaster;
} if ((isNaN(num))||(num[0] != '51') || (num[0] != '52') || (num[0] != '53') || (num[0] != '54') ||(num[0] != '55') || (num.length != 16)) {
return false;
} else {
return true;
}
}
I am trying to validate a credit card, either visa or mastercard.... with what i have above, visa isn''t working and if i input a visa card number when mastercard is selected will return true... but if i put in a mastercard number when mastercard is selected it returns false..... Not sure what I am doing wrong?