HTML CODE
HTML EXPLAINATION
<HTML>

<HEAD>
<TITLE>CREDIT CARD INFORMATION FORM </TITLE>
<HEAD>
<SCRIPT LANGUAGE="JavaScript";>

function multipleCheck()
{
formObj = document.form2;

if (formObj.c_c_no.value == "")
{

alert("You have not filled in the name credit card number field.");
formObj.c_c_no.focus(); return false;
}

else if (formObj.c_c_type.value == "")
{

alert("You have not selected the type of credit card.");
formObj.c_c_type.focus(); return false;
}


myformObj = document.form2.c_c_no.value;

if (myformObj.length < 5)

{alert("input is wrong"); formObj.c_c_no.focus(); return false;}


/* ISN Toolbox Copyright 1996, Infohiway, Inc.
*/ var nr=0;


nr1=document.form2.c_c_no.value;
flg=0;
str="";
spc=""
arw="";


for (var i=0;i {

cmp="0123456789"
tst=nr1.substring(i,i+1)


if (cmp.indexOf(tst)<0)
{
flg++;
str+=" "+tst;
spc+=tst;
arw+="^";
}
else{arw+="_";}
}
if (flg!=0)
{
if (spc.indexOf(" ")>-1)
{
str+=" and a space";
}


alert(nr1+"\r"+arw+"\rI'm sorry. This entry must be a number. I found "
+flg+" unacceptable: "+str+".");

formObj.c_c_no.focus();
return false;
}
}


</SCRIPT>
</HEAD>

<BODY>

<CENTER> <P> <FONT SIZE=+3> Credit Card Information Form
</FONT> </P> </CENTER>


<FORM ACTION="http://ectweb2.cs.depaul.edu/my_name316/asp_script.asp" METHOD=POST NAME="form2">>



Credit Card Number

<INPUT type="radio" name="c_c_type" value="visa" CHECKED> Visa

<INPUT type="radio" name="c_c_type" value="mastercard">> Mastercard

<INPUT type="radio" name="c_c_type" value="discovercard">> Discovercard



<P>> <INPUT TYPE="SUBMIT" VALUE="Click here to submit the information" onClick="return multipleCheck()">> </P>>

<P>> <INPUT TYPE="RESET" VALUE="Reset the screen">> </P>>

<P>> </FORM>> </P>>

</BODY>>

called when user clicks Submit;
checks for data entry
formObj references the form
if the user didn't enter card #,
the message popls out telling that you did not enter card #
if user didn't select card type,
the message popls out telling that you did not enter card type

myformObj refers to card # input
the number must be at least 5
digits long; otherwise, the input is
wrong



store card # into nr1 variable
initialize flg variable to 0
initialize str to empty string
initialize spc to empty string
initialize arw to empty string


Begin the loop through each
digit of card #; increment i by 1 each
time until all digits have been examined


cmp are inputs allowded in database
tst stores the cahracter to test


character insn't valid; not in cmp "database" so
go through loop if invalid character:
flg counts number of invalid characters
keep track of invalid characters; concatenate
store test char in spc to later check for space
invalid; so, arw stores ^ for this position


valid character, execute:
arw checks for valid char


if there's an invalid char,
check if invalid char is a space
if char is a space, str will store literal:
'and a space' to be later printed


user is promped if invalid chars exist,
of the number of invalid chars, the chars
themselves, with the appropriate symbols.

create text box for entering credit card
number

create set of radio buttons for credit
card type


when user hits submit, the multipleCheck()
function is called