View Single Post
Old 03-26-2003, 09:42 AM   #3 (permalink)
jcramer83
Registered User
 
jcramer83's Avatar
 
Join Date: Mar 2003
Location: Kansas
Posts: 3
jcramer83 is on a distinguished road
I've tried to use if/else statements. This is how far I got before starting to mess with defining/calling functions:


number1 = Math.floor( 1+ Math.random() * 9 );
number2 = Math.floor( 1+ Math.random() * 9 );

document.writeln("<h1>How much is " + number1 + " and " + number2 + "?</h1>" );

answer = window.prompt( "Correct answer?" );

number3 = number2 * number1


if ( number3 == answer )
window.status = "Very good!";

else {

window.status = "No. Please try again.";

}


But, it would show the "very good" if the answer was correct, and if it was wrong, it would show the "no, try again."

The instructions want me to use a function at execution and whenever the user answers correctly.

However, I am having dificulty defining/calling the functions.

Is what I have done on the right track? Or am I going to have to start over?
jcramer83 is offline   Reply With Quote