Well Duane was kind enough to re-write it for me, but all and all I think it
was the use of || and && in the code.

It ended up looking like so.


var number = document.forms[0].card_number.value;
var type =
document.forms[0].card_type[document.forms[0].card_type.selectedIndex].value
;
var first_number = number.substring(0,1);

switch (type) {
case "VISA":
if ( parseInt(first_number) != 4){
alert("Invalid Visa Card Number");
return false();
}
break;

case "AMEX":
var first_two_numbers = number.substring(0,2);
if ( parseInt(first_two_numbers) != 34 && parseInt(first_two_numbers) !=
37){
alert("Invalid American Express Card Number");
return false();
}
break;

case "MAST":
var first_two_numbers = number.substring(0,2);
if ( parseInt(first_two_numbers) < 50 || parseInt(first_two_numbers) > 56 ){
alert("Invalid Mastercard Number");
return false();
}
break;

case "DISC":
var first_four_numbers = number.substring(0,4);
if( parseInt(first_four_numbers) != 6011){
alert("Invalid Discover Card Number");
return false();
}
break;
}


Doug
----- Original Message -----
From: "Nate Smith" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Tuesday, November 27, 2001 11:17 AM
Subject: RE: SOLVED... OT Quick JS ?


> What ended up being the solution?
>
> Nate
>
>
>
> > -----Original Message-----
> > From: Douglas L. Brown [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, November 27, 2001 2:27 PM
> > To: CF-Talk
> > Subject: SOLVED... OT Quick JS ?
> >
> >
> > Thanks for the help everyone it is appreciated.
> >
> >
> >
> >
> > Doug
>
>
>
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to