Its for my OU course....

Im pretty much new to Java so im not overly sure what im doing. Basically, i have a script wich the purpose is to prompt for, store in a ariable, a numerical value wich is entered by the user, in a ranger from 1 to an upper limit determined by another variable. If the user fails to enter the value required in the range, the program will continue to ask the user to input a value. When an acceptable value is is input, the program should write that value to the output document. It is also assumed btw tht the users input is numeric.

Here is what i have done so far, though i am aware there are syntax errors and also some errors in logic wich is preventing the damn thing from running, can anyone help me debug this or help put me on the right lines? Thanks for your help! =)

Enter a number

var userInput;
var userNumber;
var upperLimit = 20;
userInput = window.prompt('Please enter a number in the range 1 to ' + upperLimit,'');
userNumber = parseFloat(userInput);
while ((userNumber = upperLimit))
{
UserInput = window.prompt('Please re-enter - number should be in range 1 to + upperLimit, '')
}
document.write(''+'Your chosen number was ' + yourNumber)

Posted By: Derek Acorah on May 27th 2007 at 14:13:41


Message Thread


Reply to Message

In order to add a post to the WotB Message Board you must be a registered WotB user.

If you are not yet registered then please visit the registration page. You should ensure that their browser is setup to accept cookies.

Log in