need help working with javascript
<p>I have created this javascript which generates a random number ranging from 0-20. What I want to do is create a text field where the user has 4 attempts to guess the generated number. How would I do this? </p>

<pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;

&lt;head&gt;
&lt;meta content="text/html; charset=utf-8" http-equiv="Content-Type" /&gt;
&lt;title&gt;Untitled 1&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form&gt;&lt;input name="code" id="code" type="text" value="" &gt;&lt;/input&gt;
&lt;script type="text/javascript"&gt;
function makeid() {
    return Math.floor(Math.random() * 20)
}
&lt;/script&gt;
&lt;input type="button" style="font-size:9pt" value="Generate Code" onclick="document.getElementById('code').value = makeid()"&gt;
&lt;/input&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
