Staredit Network

Staredit Network -> Computers and Technical -> Javascript
Report, edit, etc...Posted by Mp)7-7 on 2006-12-07 at 13:07:25
I need help with javascript. I need to make a page that creates a prompt window where the user inputs a 4 letter password. The program adds 7 to all the numbers, and get the modulus of 10, Then swith the 1st and the 3rd number and the 2nd and the 4th numbers

This is my script so far:
CODE
 <title>Javascript</title>

 <script type="text/javascript">

  <!--
   var num = prompt ("Enter your four digit code","0");

    var num = new Array(4)
    var num = new Array("number1","number2","number3","number4");
    var add = 7;

     num1 = parseInt (number1);
     num2 = parseInt (number2);
     num3 = parseInt (number3);
     num4 = parseInt (number4);

      if (num1 >= 0 && num1 <= 9999)
       num1 = (num1 + add);
       num2 = (num2 + add);
       num3 = (num3 + add);
       num4 = (num4 + add);

       num1 = (num1 % 10);
       num2 = (num2 % 10);
       num3 = (num3 % 10);
       num4 = (num4 % 10);

        document.write ("<h4>" + num3 + "" + num4 + "" + num1 + "" + num2 + "</h4>");

      else
       window.alert ("You didnt enter the correct number of Digits, Reload the page.");


  // -->
 </script>
</head>
Next Page (1)