Hi,
I'm brand new to this forum, so please excuse any ignorance.
I really need some help, as I don't really know javascript much at all. I need a web script (I think a form will fit the bill) that has an two input boxes.
One will be a text input box and one will be a number input box.
1. When a character is inserted in the first box, if it is any of the letters of the english alphabet, the script assigns it the first number that has been typed in the number box (the numbers will have to be separated with a space).
2. Then if the number that the letter has been assigned is lower than 26, the script jumps to stage 3, treating (nMod) as . If it is higher than 26, the script then runs the calculation %26
(i.e. this finds the remainder after dividing the number by 26, but you already knew that).
3. The script then adds the answer (nMod) to the number (nCor) that corresponds to the original letter if you use the rule "A=1, B=2 etc." So (nMod)+(nCor)
4. If the answer to this (nMC) is lower than 26, it then finds the letter that corresponds to it according to the above rule. This letter is then printed out in another text box.
5. If the answer is higher than 26, it minuses 26 from the number and then does the above. So (nMC)-26
6. It does this for each letter, and for anything that is not part of the english alphabet, it just prints it out in the text box without changing it.
So, if I put the letter R in the text input box, and the number 40 in the number input box, it will assign 40 to R, then do 40%26, which is 14. It will then add 14 to the number which corresponds to R, which is 18. The answer to this is 32. As this is greater than 26, it will do 32-26, which is 6. It will then print out the letter that corresponds with 6, which is F.
The problem is, I have a basic grasp of Javascript, (kind of.) and can do else...if...else functions, but I have no idea how you would get the script to see a letter in a text box, and then do things with it. Any help would be appreciated.
Harry.
Oh and BTW, the variables I defined above are just to make my explanation a bit clearer, they don't necessarily represent variables in the script.
I'm brand new to this forum, so please excuse any ignorance.
I really need some help, as I don't really know javascript much at all. I need a web script (I think a form will fit the bill) that has an two input boxes.
One will be a text input box and one will be a number input box.
1. When a character is inserted in the first box, if it is any of the letters of the english alphabet, the script assigns it the first number that has been typed in the number box (the numbers will have to be separated with a space).
2. Then if the number that the letter has been assigned is lower than 26, the script jumps to stage 3, treating (nMod) as . If it is higher than 26, the script then runs the calculation %26
(i.e. this finds the remainder after dividing the number by 26, but you already knew that).
3. The script then adds the answer (nMod) to the number (nCor) that corresponds to the original letter if you use the rule "A=1, B=2 etc." So (nMod)+(nCor)
4. If the answer to this (nMC) is lower than 26, it then finds the letter that corresponds to it according to the above rule. This letter is then printed out in another text box.
5. If the answer is higher than 26, it minuses 26 from the number and then does the above. So (nMC)-26
6. It does this for each letter, and for anything that is not part of the english alphabet, it just prints it out in the text box without changing it.
So, if I put the letter R in the text input box, and the number 40 in the number input box, it will assign 40 to R, then do 40%26, which is 14. It will then add 14 to the number which corresponds to R, which is 18. The answer to this is 32. As this is greater than 26, it will do 32-26, which is 6. It will then print out the letter that corresponds with 6, which is F.
The problem is, I have a basic grasp of Javascript, (kind of.) and can do else...if...else functions, but I have no idea how you would get the script to see a letter in a text box, and then do things with it. Any help would be appreciated.
Harry.
Oh and BTW, the variables I defined above are just to make my explanation a bit clearer, they don't necessarily represent variables in the script.