What is wrong with my JavaScript? It won't compute and display the value I want it to; it's driving me bonkers!
<p>What is wrong with my JavaScript?  </p>

<pre><code>&lt;?xml version = "1.0" encoding ="utf-8"?&gt;
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1 /DTD/xhtml1-strict.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;

 ...

&lt;body&gt; 
   &lt;p&gt;
   &lt;a href="http://nova.umuc.edu/~ct386a28/handson/index.html"&gt;Main Page&lt;/a&gt;
&lt;/p&gt;
&lt;h1&gt;GAS MILEAGE CALCULATOR&lt;/h1&gt; 

&lt;form action="" method="post"&gt;

&lt;script type = "text/javascript"&gt;

 function mileageCalculator (beginMil, endMil, galCons, form)
 {

    var bM = parseFloat(beginMil);
    var eM = parseFloat(endMil);
    var gC = parseFloat(galCons);

    if((eM&lt;0)||(bM&lt;0)||(gC&lt;0))
    {
        alert("ERROR: One or more input(s) is negative.");
        form.begMileage = " ";
        form.endMileage = " ";
        form.galConsumed = " ";   
    }

    else if ((eM == 0) || (gC == 0))
    {
        alert("ERROR: The end mileage and/or gallon input is zero.");
        form.begMileage = " ";
        form.endMileage = " ";
        form.galConsumed = " ";            
    }

    else if (eM &lt; bM)
    {
        alert("ERROR: End mileage is less than begining mileage.");
        form.begMileage = " ";
        form.endMileage = " ";
        form.galConsumed = " ";
    }
    else 
    {                               
        form.mpg.value = ((bM - eM) / gC);  

    } 
 }

 &lt;/script&gt;



    &lt;div class = "center"&gt;              
        &lt;h3&gt;Enter beginning mileage:&lt;/h3&gt;   
        &lt;input type="text"  name ="begMileage" tabindex="1" /&gt;
        &lt;br /&gt;
        &lt;h3&gt;Enter ending mileage:&lt;/h3&gt;
        &lt;input type="text" name ="endMileage" tabindex="2"  /&gt;
        &lt;br /&gt;
        &lt;h3&gt;Enter gallons consumed:&lt;/h3&gt;
        &lt;input type="text" name ="galConsumed" tabindex="3" /&gt;
        &lt;br /&gt;

        &lt;h2&gt;TOTAL MILES PER GALLON&lt;/h2&gt;
        &lt;input type="text" name ="mpg" tabindex="4" /&gt; &lt;br /&gt;

    &lt;/div&gt;

    &lt;p&gt;&lt;br /&gt;&lt;/p&gt;

    &lt;p&gt;         
     &lt;br /&gt;&lt;input type="submit" value="SUBMIT" onclick = "mileageCalculator"/&gt; &lt;input type="reset" value="CLEAR"/&gt; &lt;br /&gt;
    &lt;/p&gt;

&lt;/form&gt;
</code></pre>

<p>
</p>
