Getting a NaN on click event
<p>I have a script that simply adds fields 2 &amp; 3, but because I have formatted the numbers as currency (<code>$x,xxx.xx</code>) field1 returns <code>NaN</code>.  Is it is possible to strip the <code>$</code> symbol from the number before doing the calculation?  I assume the comma and period won't cause the same issue.</p>

<pre><code>onclick="document.getElementById('field1').value = (Math.round((parseFloat(document.getElementById('field2').value,2)*100))/100 + Math.round((parseFloat(document.getElementById('field3').value,2)*100))/100).toFixed(2);"  
</code></pre>

<p>prior to clicking the calculate button, I am formatting the numbers being added <code>onblur="forA();"</code> (as soon as user leaves fields) with:</p>

<pre><code>function forA() { 
    document.getElementById('fieldY').value = "$" + addCommas1(document.getElementById('fieldZ').value); 
} 

function addCommas1(nStr) {
    nStr += '';
    x = nStr.split('.');
    x1 = x[0];
    x2 = x.length &gt; 1 ? '.' + x[1] : '';
    var rgx = /(\d+)(\d{3})/;
    while (rgx.test(x1)) {
        x1 = x1.replace(rgx, '$1' + ',' + '$2');
    }
    return x1 + x2;
}
</code></pre>
