title: Celsius and Fahrenheit Converter- JavaScript
body: <p>I want to make a webpage that has two text boxes, a Celsius and Fahrenheit box. In between them, there is a convert button which converts Celsius to Fahrenheit and Fahrenheit to Celsius. If there is letters in either box, I want to cancel the converting and an alert pop up saying "Only numbers please!" So far, I haven't figured out how to get the alert and when I type numbers in the Celsius box, it always says the number -18 in the same box. Fahrenheit is fine.</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;Temparature Converter&lt;/title&gt;
    &lt;script type="text/javascript" src="tempconversion.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
    Celsius: &lt;input id="c" onkeyup="convert('C')"&gt;
    &lt;button type="button" id="convert" onclick="convertTemp()"&gt;Convert&lt;/button&gt;
    Fahrenheit: &lt;input id="f" onkeyup="convert('F')"&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>JavaScript:</p>
  
  <pre><code>function convertTemp(degree) {
    if (degree == "C") {
      F = document.getElementById("c").value * 9 / 5 + 32;
      document.getElementById("f").value = Math.round(F);
    } else {
      C = (document.getElementById("f").value -32) * 5 / 9;
      document.getElementById("c").value = Math.round(C);
    }
  }
  </code></pre>
  
  <p>Note: I got some code from W3Schools so I think the onkeyup convert is a little funny. If possible, please notify me how it has to change as well as the JavaScript.</p>