title: Javascript output text based on input value
body: <p>I'm trying to make a form where you input a number to a textbox and based upon that a text response is put in a textbox.
  This is an example of what I have been trying to make work:</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;script type="text/javascript"&gt;
              function calculate()
              {
                  var ph = document.test.ph.value;
                  if (ph &gt; 7.45) {
                      var str = "Alkalosis";
                  }
                  else if (ph &lt; 7.35) {
                      var str = "Acidosis";
                  }
                  else {
                      var str = "Normal";
                  }
                  document.test.acidalk.value = str;
              }
          &lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;form name="test"&gt;
              pH&lt;input type="textbox" name="ph"&gt;&lt;br&gt;
              &lt;input type="submit" value="Calculate"&gt;&lt;br&gt;
              &lt;input type="textbox" id="acidalk" &gt;
          &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The idea of what I'm trying to achieve is if a number higher than 7.45 is put in the first text box, the button clicked, then the word "Alkalosis" is put in the second text box, but if the number is less than 7.35, the word is "Acidosis" instead.</p>
  
  <p>Any help would be greatly appreciated</p>