Javascript Simple Calculation giving NAN or 0
<p>Can anyone work out why this does not work. Produces NAN and if reset for a Number(document on var inputs produces 0. The script is supposed to add up an indefinite number of fields starting with an ID of product_total_price_PRI_ ... .</p>

<p>Obviously I've missed something and have got a headache from trying to see it. </p>

<pre><code>function getFields() {
    var inputs = document.getElementsByTagName('input');
    var result = 0;
    for( var i = 0; i &lt; inputs.length; i++ ) {
        if( inputs[i].id.indexOf('product_total_price_PRI_') == 0 );
           result += parseFloat(inputs[i].value); 
     }

    alert(result);
}
</code></pre>
