Topic awaiting preservation: Loppy over loops |
|
---|---|
Author | Thread |
Paranoid (IV) Inmate From: The Dark Side of the Moon |
posted 09-06-2003 20:36
OK, here is the problem. I want to limit the input in the prompt to be 0-25. If the user inputs a number higher than this or uses letters, I want to have the input box pop back up and tell them to enter a valid number. Here is the code I have: code: var myNumber = parseFloat(prompt("Enter a number between 1 and 25",""));
|
Paranoid (IV) Inmate From: A graveyard of dreams |
posted 09-06-2003 21:21
The reason you get the infinite while loop is that you never change myNumber, you should add 'myNumber= ' in front of the second promt message. code: var myNumber = parseFloat(prompt("Enter a number between 1 and 25",""));
|
Maniac (V) Mad Scientist From: 127 Halcyon Road, Marenia, Atlantis |
posted 09-07-2003 05:18
damn! Beat me to it! *ahem* ...by a lot... |