WestSide2003
Technical User
Hi,
I have this function that verifies credit card info....
I wanted to know....how can I use this same function on other pages in the site with different form names and perhaps different field names... right now I will settle for it working with the same field names but different form names.
Some of my pages have more than 1 form so I can't use document.forms[0].fieldName or whatever......
Currently I hardcoded the name of my form and its fields too
so I have statements like if(myformname.CreditCardNumber.value.length == 0) {
alert("Some Error");
}
However, I want to call this function from other pages and I get an error because its looking for the form "myformname", how can I make it more generic.. I am new to JavaScript, so if you respond, please keep that in mind.
Thanks
-WS
I have this function that verifies credit card info....
I wanted to know....how can I use this same function on other pages in the site with different form names and perhaps different field names... right now I will settle for it working with the same field names but different form names.
Some of my pages have more than 1 form so I can't use document.forms[0].fieldName or whatever......
Currently I hardcoded the name of my form and its fields too
so I have statements like if(myformname.CreditCardNumber.value.length == 0) {
alert("Some Error");
}
However, I want to call this function from other pages and I get an error because its looking for the form "myformname", how can I make it more generic.. I am new to JavaScript, so if you respond, please keep that in mind.
Thanks
-WS