I joined few days ago this forum. I am trying to learn JavaScript and, as a "real case" exercise, I chose a simple MathGame I coded in VBA a while ago and I try to "translate" it in JavaScript.

Now I bumped into a new obstacle and I request your kind advice. I describe the issue:

- Desired behavior: Two random numbers are generated (integers, between 0-10, sum < 11) and their the addition is displayed. The player has to input the result in a textbox and press ENTER. The result has to be evaluated by the script (if it is the correct addition result) ... and for the moment let's stop here.
- What I achieved: The two numbers are generated and displayed, the textbox is displayed and make the refresh for each new addition.
- Where I got stuck: I failed to pass the user input (addition result) for evaluation.

I read tens of pages of information but I still cannot figure the proper method (or maybe correct syntax) for using the value input by user.

For complete info, here is the code up to this moment:

<!DOCTYPE html>
<html>
<body>
<p id="calc"></p>
<button onclick="Add()">CLICK HERE for a new addition</button>
<script>
function Add()
{
var y = Math.floor((Math.random()*11)+0)
var x = Math.floor((Math.random()*11)+0)
while ((x+y)>10)
{
var y = Math.floor((Math.random()*11)+0)
var x = Math.floor((Math.random()*11)+0)
}
var display = document.getElementById("calc")
display.innerHTML = x + " + " + y + " = <input type='text' name='result' id='result' size='4' autofocus>"
}
</script>
</body>
</html>]


I thank you in advance for any suggestion you might have.

Of course that for regular JS users the problem should be elementary. But please keep in mind I am totally new to JS and i am striving for better results.