title: Submit Button Not Calling Function
body: <p>Please forgive any potential lapses in protocol and/or formatting. I'm new at this. Clicking on my "submit" button does not call the function cost(). What am I doing wrong?</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  
  &lt;script type="text/javascript"&gt;
  function cost() {
  mpg = document.getElementById("mpg");
  distance = document.getElementById("distance");
  gasPrice = document.getElementById("gasPrice");
  alert("&lt;p&gt;" + Math.round((distance / mpg) * gasPrice) + "&lt;/p&gt;");
  }
  &lt;/script&gt;
  
  &lt;h1&gt;Trip Cost Calculator&lt;/h1&gt;
  &lt;/head&gt;
  
  
  &lt;p&gt; Enter mpg (miles): &lt;/p&gt;
  &lt;input type="text" id="mpg"&gt;
  &lt;/input&gt;
  &lt;/body&gt;
  
  &lt;body&gt;
  &lt;p&gt; Enter distance (miles): &lt;/p&gt;
  &lt;input type="text" id="distance"&gt;
  &lt;/input&gt;
  &lt;/body&gt;
  
  &lt;body&gt;
  &lt;p&gt; Enter gas price (dollars): &lt;/p&gt;
  &lt;input type="text" id="gasPrice"&gt;
  &lt;/input&gt;
  &lt;/body&gt;
  
  &lt;body&gt;
  &lt;/br&gt;
  &lt;input type="button" id="submit" value="Submit" onclick="cost()"/&gt;
  &lt;/body&gt;
  </code></pre>