Ja\/askript help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Dildozer
    Confirmed User
    • Jul 2002
    • 7519

    #1

    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
  • gornyhuy
    Chafed.
    • May 2002
    • 18041

    #2
    The board fucked your code all up....

    i suggest you go to j a va sc ri ptsource.com and search there for prebuilt examples, or go here:

    http://www.vtfb.org/vfbmember/overview.htm

    and click on the FormChek.js and in that code search for stripwhitespace. Lots of good examples in there.

    icq:159548293

    Comment

    • Dildozer
      Confirmed User
      • Jul 2002
      • 7519

      #3
      thanks
      Spam link here

      Comment

      Working...