title: What`s wrong with my output?
body: <p>I'm trying to do a guessing number game, and it's right output should display line by line : Attempt 1 Your guess xx is too small(big)
                 Attempt 2 Your guess xx is too small(big)
                 Attempt 2 Your guess xx is too small(big)
                    ...</p>
  
  <p>but my output is always changing at the same line like this:
  Attempt 3 Your guess xx is too small(big) 
   I don't know the problem,please help.</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt; &lt;title&gt; Guessing game &lt;/title&gt;
  &lt;/head&gt;
  &lt;body onload="noGen()" &gt;
  &lt;script type = "text/javascript"&gt;
  var theNumber;
  function noGen(){ 
  theNumber= Math.floor(Math.random()*999+0) ; //get a random number 
  }
  &lt;/script&gt;
  &lt;h1&gt; Guessing game &lt;/h1&gt;
  &lt;p&gt; You have 10 chances! &lt;/p&gt;
  &lt;p&gt;Hint: the number is between 0 and 999 &lt;/p&gt;
  
  &lt;p id="myguess"&gt; &lt;/p&gt;
  &lt;p&gt;
  &lt;input id="tryno" type="text" /&gt;
  &lt;input type="button" value="GUESS" onclick="attempt()" /&gt;
  &lt;/p&gt;
  &lt;script type= "text/javascript"&gt;
  i=0;
  function attempt(){ 
  var guess=document.getElementById('tryno');
  var myNumber=guess.value;
  i++;
  if(i&lt;11)
       { 
  if (myNumber&lt;theNumber){
         document.getElementById("myguess").innerHTML="Attempt  "+i+" Your    guess "+ myNumber+ " is too small";
  
  }
  else if (myNumber&gt;theNumber) 
     {document.getElementById("myguess").innerHTML="Attempt "+i+"  Your guess "+ myNumber+ " is too big";
  </code></pre>
  
  <p>} </p>
  
  <pre><code>else if (myNumber==theNumber){ 
  document.getElementById("myguess").innerHTML="Attempt "+i+"  Your guess "+ myNumber+ " is correct"; 
   document.getElementById("info").innerHTML= "You win!";}  }
  else
    {  document.getElementById("info").innerHTML= "You lose!";}
  </code></pre>
  
  <p>}</p>
  
  <pre><code>&lt;/script&gt;
  &lt;p id="info"&gt;&lt;/p&gt;
  &lt;/body&gt;
  &lt;/html&gt; 
  </code></pre>