title: html <input type="text" /> onchange event not working
body: <p>I am trying to do some experiment. What I want to happen is that everytime the user types in something in the textbox, it will be displayed in a dialog box. I used the <code>onchange</code> event property to make it happen but it doesn't work. I still need to press the submit button to make it work. I read about AJAX and I am thinking to learn about this. Do I still need AJAX to make it work or is simple JavaScript enough? Please help.</p>
  
  <p><b><code>index.php</code></b></p>
  
  <pre><code>&lt;script type="text/javascript" src="javascript.js"&gt; &lt;/script&gt;
  
  &lt;form action="index.php" method="get"&gt;
   Integer 1: &lt;input type="text" id="num1" name="num1" onchange="checkInput('num1');" /&gt; &lt;br /&gt;
   Integer 2: &lt;input type="text" id="num2" name="num2" onchange="checkInput('num2');" /&gt; &lt;br /&gt;
   &lt;input type="submit" value="Compute" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><b><code>javascript.js</code></b></p>
  
  <pre><code>function checkInput(textbox) {
   var textInput = document.getElementById(textbox).value;
  
   alert(textInput); 
  }
  </code></pre>