Javascript, form validation, getting NaN
<p>in a form, onkeypress, I call this function:</p>

<pre><code>function calculate() {

    var subtotal = parseInt(document.form1.product1.value) * product1 + 
                    parseInt(document.form1.product2.value) * product2 + 
                    parseInt(document.form1.product3.value) * product3;
    alert(typeof subtotal);
    alert(subtotal);
    var total = subtotal + parseInt(document.form1.shipping.value);

    document.form1.subtotal.value = subtotal;
    document.form1.total.value = total;
}
</code></pre>

<p>When I alert the typeof subtotal, I get number.  But then when I alert the subtotal, I get NaN.  What am I missing?  Thanks.</p>
