How to create a number guessing game in JavaScript
<p>I need to create a number guessing game that receives a value using document.getElementById and outputs it to a textarea using document.getElementByid.  I need to create a random number that the user can guess against.  the user will put the information into a text box in html and as the user guesses it will store the answers in the output text area.  The first guess will either display too high or too low, and then any answer after that will display warmer or colder.  I am not sure were to start.  Here is a sample of the html.  Any help would be greatly appreciated.</p>

<pre><code>  &lt;form&gt;
 &lt;fieldset&gt;
  &lt;legend&gt;Inputs&lt;/legend&gt;
    &lt;label for="guess"&gt;Your Guess:&lt;/label&gt;
     &lt;input type="text" id="guess" value="523" /&gt;
    &lt;input type="button" onclick="yourGuess()" value="submit" /&gt;&lt;br /&gt;
    &lt;input type="button" onclick="" value="Show My Guesses" /&gt;  
    &lt;input type="button" onclick="" value="New Game" /&gt;&lt;br /&gt;
    &lt;input id="cheat" type="checkbox" value="cheat" /&gt;
    &lt;label for="cheat"&gt;Cheat&lt;/label&gt;
&lt;/fieldset&gt;
 &lt;fieldset&gt;

    &lt;legend&gt; Output &lt;/legend&gt; &lt;textarea id="output" name="output" rows="5"       style="width: 100%;"&gt;              
    &lt;/textarea&gt;
  &lt;/fieldset&gt;
&lt;/form&gt; 
</code></pre>

<p>JavaScript code:</p>

<pre><code>function yourGuess()
{
var guess1 = document.getElementById("guess").value;
var guess2 = 501;
var newGuess = Math.floor(guess2);
var n = 0;

if (newGuess &lt; guess1) {
    yourReturn = "Your are too low!!!"
}
else {
    if (newGuess &gt; guess1) {
        yourReturn = "You are too high!!!"
    }
    else {
        yourReturn = "Correct, You are the winner!!!"
    }       
}
}
</code></pre>
