I need help with javascript?
-
//This code isnt displaying anything. its translated from java into javascript. //its supposed to take input from a prompt and then translate it into a code called rot13 //then display it on the webpage but its not even displaying the prompt <html> <body> <script type="text/javascript"> function isAlpha(str) { var re = /[^a-zA-Z]/g if (re.test(str)) return false; return true; } var keyLower = new Array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'); while(true) { var output = ''; var input = prompt("Enter text to be cyphered:); var i = 0; for(i = 0; i<input.length; i++) { if(!isAlpha(input.charAt(i))) //if not a letter { output += input.charAt(i); } else if(input.charAt(i).toLowerCase() == input.charAt(i)) //if a lower case character { for(var j = 0; j<26; j++) { if(input.charAt(i) == keyLower[j]) { output+=keyLower[(j+13)%26]; } } } else //if an Upper Case character { var k = 0; for(k = 0; k<26; k++) { if(input.charAt(i).toLowerCase() == (keyLower[k])) { output+=(keyLower[(k+13)%26]).to… } } } } document.write(output); } </script> </body> </html>
-
Answer:
var input = prompt("Enter text to be cyphered:); Change it to var input = prompt("Enter text to be cyphered:"); Missing the end quote :P Works good too.
Domo Nazi at Yahoo! Answers Visit the source
Related Q & A:
- I need help on what I need to buy or do.Best solution by Yahoo! Answers
- I need help with some horse questions, can you help me.Best solution by Yahoo! Answers
- I did something really bad and now i need help please help me.Best solution by Yahoo! Answers
- I need help with a song I heard.Best solution by Yahoo! Answers
- I am planning a trip to El Salvador and I need help.Best solution by nomadicmatt.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.