I am new to Javascript, but have a relatively simple form that is giving me problems.

The following code is my form, if one of the fields is left blank (and there will usually be one left blank) the calculation returns NaN and will not perform the task needed. I initially had the form set to calculate in metric kilometers and liters, when I converted the math portion to miles and gallons it started doing this.

This is the line giving me the problems:
var cars_emissions=(((mileage1/efficiency1)*0.3732417216/1000)+((mileage2/efficiency2)*0.3732417216/1000)+((mileage3/efficiency3)*0.3732417216/1000));

The original was:
var cars_emissions=(((mileage1/100)*efficiency1)+((mileage2/100)*efficiency2)+((mileage3/100)*efficiency3))*0.002356902;

I do not know why the new line of code will not perform as the original did.





Code:
<script language="javascript">
<!--
function calculate (form)
{


	var mileage1=form.mileage1.value;
	var mileage2=form.mileage2.value;
	var mileage3=form.mileage3.value;
	var efficiency1=form.efficiency1.value;		
	var efficiency2=form.efficiency2.value;
	var efficiency3=form.efficiency3.value;	
		
		
	var cars_emissions=(((mileage1/efficiency1)*0.3732417216/1000)+((mileage2/efficiency2)*0.3732417216/1000)+((mileage3/efficiency3)*0.3732417216/1000));
		
		form.cars_emissions.value=(Math.round(cars_emissions*10)/10)
	form.total_emissions.value=(Math.round((cars_emissions)*10))/10
}
//-->
</script>

<div id="page" style="width: 770px; height: 87px">
	<div id="content">
		<div class="post hr">
			<form name="Calculator" method="POST">

		<h2>Calculate the CO<sub>2</sub> emissions produced to operate your cars: </h2>
				</p>
				<table border="0" width="65%" cellspacing="1">
					<tr>
						<td>&nbsp;</td>
						<td>Annual Mileage<p>(mi)</td>
						<td>Fuel Efficiency<p>(mi/gal)</td>
					</tr>
					<tr>
						<td>CAR #1</td>
						<td>&nbsp;<input name="mileage1" value="" type="text" size="10" /></td>
						<td>&nbsp;<input name="efficiency1" value="" type="text" size="10" /></td>
					</tr>
					<tr>
						<td>CAR #2</td>
						<td>&nbsp;<input name="mileage2" value="" type="text" size="10" /></td>
						<td>&nbsp;<input name="efficiency2" value="" type="text" size="10" /></td>
					</tr>
					<tr>
						<td>CAR #3</td>
						<td>&nbsp;<input name="mileage3" value="" type="text" size="10" /></td>
						<td>&nbsp;<input name="efficiency3" value="" type="text" size="10" /></td>
					</tr>
				</table>

					<table border="1" width="90%">
					<tr>
						<td align="center"><b>&nbsp;Cars</b></td>
						<td align="center"><b>&nbsp;TOTAL</b></td>
					</tr>
					<tr>
						<td align="center"><b><span style="font-size: 2em">
						<input name="cars_emissions" value="" type="text" size="6" /></font></span></b></td>
						<td align="center"><b><span style="font-size: 2em">
						<input name="total_emissions" value="" type="text" size="9" /></font></span></b></td>
					</tr>
				</table>
				
				</p>
				<input class="button" type="button" value="Calculate" onclick="calculate(this.form)" name="Calculate"></p>		
			</form>
I appreciate any help you can provide a newcomer.