Alternative A:

($(tpd_#i#).text())*1

Alternative B:

parseInt($(tpd_#i#).text())

Also, keep in mind that when adding numbers (with decimal places) in
JavaScript there's a math precision bug. I forget the example that always
breaks, but something like 64.11 + 64.11 should equal 128.22, but JavaScript
will add it up to something like 128.211111111119. Just wanted to point this
out in case you're adding numbers with decimal places together. In which
case it's better to multiply your values by 100 (make them whole numbers)
add them together, then divide the sum by 100.

Brian.


On 6/22/07, cfdvlpr <[EMAIL PROTECTED]> wrote:


Actually, this was withing <script> tags in the <head> section of
HTML.
I found the answer to my question...
It turns out if I cast the variables to a number like this it works:

var tpdSum = 0;
tpdSum = 0
         <cfloop from="1" to="#arrayLen(session.cart)#" index="i">
                          + Number($(tpd_#i#).text())
         </cfloop>;

alert(tpdSum);


Reply via email to