title: How to output JavaScript into a Textbox
body: <p>Sorry I'm rather new to coding in JavaScript. I'm trying to make a simple program that takes two inputs, for base and height, and outputs the area of a triangle.</p>
  
  <p>My HTML is this:</p>
  
  <pre><code>&lt;form name="input" action="" method="get"&gt;
          &lt;label for=""&gt;Width (b): &lt;/label&gt;&lt;input type="textbox" name="width"&gt;&lt;/input&gt;&lt;br&gt;
          &lt;label for=""&gt;Height (h): &lt;/label&gt;&lt;input type="textbox" name="height"&gt;&lt;/input&gt;&lt;br&gt;
          &lt;button onClick="calculateArea()"&gt;Calculate area&lt;/button&gt;
  &lt;/form&gt;
  
  &lt;label for="output"&gt;The area is: &lt;/label&gt;&lt;input type="textbox" name="output"&gt;&lt;/input&gt;
  </code></pre>
  
  <p>And my JavaScript is this:</p>
  
  <pre><code>function calculateArea() {
  
  var base = document.getElementById('width').value;
  var height = document.getElementById('height').value;
  var out = (1/2) * parseFloat(base) * parseFloat(height);
  
  document.output.value = out;
  
  }
  </code></pre>
  
  <p>I've tried changing the name="output" of the output textbox to an ID and using getValueByID, but it has made no difference. Any help would be appreciated.</p>