title: HTML input and submitting
body: <p>I tried to input some values and put it below after submitted, but every time the browser just refresh itself and add "?a=&amp;b=" to the original url. The added content will then disappear.</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
      &lt;title&gt;&lt;/title&gt;
      &lt;script&gt;
          function calculate(){
              var aNode = document.getElementById('a');
              var bNode = document.getElementById('b');
              var a = parseFloat(aNode.value);
              var b = parseFloat(bNode.value);
              var result = a / Math.pow(b,2);
              result = result.toFixed(2);
              var commentText = document.createTextNode(result);
              var node = document.getElementById("comments")
              node.appendChild(commentText);
          }
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form name = "form" action = "index.html" onSubmit = "calculate()"&gt;
      num1 &lt;input id="a" type="text" name="a"&gt;&lt;br&gt;
      num2 &lt;input id="b" type="text" name="b"&gt;&lt;br&gt;
      &lt;input type="submit" value="Calculate"&gt;
      &lt;/form&gt;
      &lt;p id="comments"&gt;&lt;/p&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>