4 Replies Latest reply on Apr 19, 2012 7:14 AM by Does this work?

    Help me debug my java script

    Does this work?

      I have a form with fields named 1 to 18.  The user will enter 4 digit numbers in the fields and then hit a button that will run a java script.  This script will encrypt each of the 4 digit numbers we call codes.  The encryption is basically taking the first digit of the code and incrementing it by 1.  Then doing the same with the second digit and then keeping the last 2 digits unchanged.  So if they enter 1234 then hit the encrypt button the return is 2334.  Entering 9012 will return 0112.  The script below that my son wrote for me doesn't work.  No change occurs when the button is hit.  Any ideas why it doesn't work?


      var code;

      var i;

      for (i=1;<=18;i++)





      code=((code[0]*1+1)%10)toString() +((code[1]*1+1)%10).toString()+code.slice(2);