<font face="arial" size="2">What leads you to believe that it is a string, even after parseFloat?<br /><br /><font size="3"><font face="Courier New" size="2">&gt; total = total+(array_prices[i])*(2);// this value works here, but I<br />&gt; hardcoded it</font><br /><br /></font>   I'm curious about this... you're assigning the array elements as strings (i.e. with quotes) rather than as integers.<br /><br />Peter<br /><br /></font>
                <font face="Tahoma, Arial, Sans-Serif" size="2">
                                <b>From</b>: "Marcelo Wolfgang" <a href="mailto:grillo@gmail.com">grillo@gmail.com</a><br /></font>
                <br />Hi list,<br /><br />First forgive me for posting code up in the email, there's no online<br />page that I can show the script.<br />I'm having a terrible, like 2 hours wasted on this terrible error,<br />trying to figure this out:<br />Here's the code:<br /><br /><pre><br />array_prices = new Array();<br />array_prices[1] = '115'; //these values are coming from a db<br />array_prices[2] = '95';<br /><br />function getCheckedValue(radioObj) {<br />        var radioLength = radioObj.length;<br />        for(var i = 0; i &lt; radioLength; i++) {<br />                if(radioObj[i].checked) {<br />                return radioObj[i].value;<br />                }<br />        }<br />}<br /><br />function updateTotal(){<br />        total = 0;<br />        totalField = document.getElementById('valorOnlyNumber');<br />        for (i=1; i &lt; array_prices.length; i++){<br />                total = total+(array_prices[i])*(2);// this value works here, but I<br />hardcoded it<br />        }<br />        rdVal = getCheckedValue(document.frm_calcShipping.valFrete);<br />        if (rdVal != 0){<br />                total = total+rdVal;<br />        }<br />        totalField.innerHTML = total;<br />}<br /></pre><br /><br />and these are my radios:<br /><br /><div id="normal-mgprrjscCapital"><input type="radio" value="6.70" /><br />name="valFrete" /&gt;R$ 6,70</div><br /><div id="normal-mgprrjscInterior"><input type="radio" value="7.20" /><br />name="valFrete" /&gt;R$ 7,20</div><br /><div id="sedex-mgprrjscCapital"><input type="radio" value="12.60" /><br />name="valFrete" /&gt;R$ 12,60</div><br /><div id="sedex-mgprrjscInterior"><input type="radio" value="18.60" /><br />name="valFrete" /&gt;R$ 18,60</div><br /><br /><div id="valor">R$<span id="valorOnlyNumber"> 210.00</span></div><br /><br />+++++++++++++++++++++<br />The problem is that rdVal is always a string, I've tried<br /><br />rdVal = parseFloat('getCheckedValue(document.frm_calcShipping.valFrete)')<br /><br />still a string<br /><br />I can't figure out what to do please someone advice<br /><br />TIA<br />Marcelo