Please help! I'll pay you!

wxdqz

New Member
Hello

I've got to write the following code, and I haven't got a clue where to start. It has to be given in on tuesday and I'm clueless. To you it is probably incredibly easy, but due to unforseen circumstances, I missed the 3 javascript lessons and haven't yet received the book I ordered, so I'm a complete novice.

Please could you help me? I promise if you do I'll put a fiver in the post or something. Thanks very much indeed, Paul.

Write an HTML page which creates a simple form. It
should have two textfields, one for the question and one for the student抯 answer. b) Use Math.random to write a function called aNumber which produces an integer in the range 1 to 12.
c) Write a function called genQuestion which sets the question textfield to display a string such as ?
times 7?where 6 and 7 represent the numbers that have been randomly generated. Use two
GLOBAL variables, declared as follows, to hold the two numbers returned by the aNumber function.
<SCRIPT LANGUAGE = "JavaScript">
var x, y; // global variables declared outside any function definitions
A global variable is one declared outside a function definition, and is accessible from all functions in
the program. (Compare this with variables declared within a function, which are only accessible from
the function they are declared in).
d) Write a function called buttonPressed, which is invoked whenever the Check my Answer button is
pressed. This function should compare the number typed by the student with the correct product of the
two numbers (held as global variables). Use the window.alert method to create a pop-up box which
either states 揅orrect ?well done!?or 揥rong ?Please try again? If the answer is correct, a new
question should be generated. Whether right or wrong the student抯 answer textfield should be cleared.
2. The use of computers in education is often referred to as Computer Aided Learning (CAL). One problem
that develops in CAL environments is student fatigue. Varying the computer抯 dialogue to hold the
student抯 attention can eliminate this. Modify the program you wrote above, so that various comments are
printed for each correct answer and each incorrect answer as follows:
Responses to a correct answer:
Very good!
Excellent!
Correct - Nice work!
Correct ?keep up the good work!
Responses to an incorrect answer:
No. Please try again.
Wrong. Try once more.
Incorrect ?Don抰 give up.
No ?keep trying.
You should use random number generation to choose a number from 1 to 4 that will be used to select an
appropriate response to each answer.
 
Top