View Single Post
Old 11-14-2003, 08:50 PM  
Dildozer
Confirmed User
 
Join Date: Jul 2002
Location: Montreal
Posts: 7,519
Ja\/askript help

ok i have this problem

in my form i have a field for credit cards

so i call that value like
form1.number.value

now the value can be numbers separated by spaces like 5555 5555 5555 5555 or all together like 5555555555555555

What i want to do is a function to check if there are spaces and remove them and give me the real value

for example the surfer puts in his cc# like this: 5258 5599 5599 5599, i want when he submits it to turn into 5258559955995599

i tried this but i get an undefined value in the end

var j= form1.number.value;
var k;
for (i=0, i=j.lenght; i++){
if (j.sub5tring(i,i+1)=' ') {
k = k+'';
k = k+j.sub5tring(i,i+1);}}
form1.number.value = k;

can anyone help me?
__________________
Spam link here
Dildozer is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote