title: trying to get a random number on button click
body: <p>I'm trying to use javascript to get a random number in the range of 0-20 to display in a text box after the user clicks a button, but I am so far unsuccessful. What is the error in my code?</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;script type="text/javascript"&gt;
      function makeid()
      {
      var randomnumber=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>