![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I'm trying to understand and display simple math results, but I get an unexpected value. Hope this isn't too confusing. I'd like to add quantities like 2 + 1 + 3 + 0 + 0 to = 6. But instead I get a result like: 21300 -- I'm trying to get a total number of items ordered using: var total1=eval(parseInt(f.item1_quan.value*23)) <- how cost total is var total2=eval(parseInt(f.item2_quan.value*41)) derived for each item, var total3=eval(parseInt(f.item3_quan.value*15)) for reference. Numbers are var total6=eval(parseInt(f.item6_quan.value*15)) item prices. var total7=eval(parseInt(f.item7_quan.value*17)) - I added: var disc_quan = (f.item1_quan.value + f.item2_quan.value + f.item3_quan.value + f.item6_quan.value + f.item7_quan.value) -- I'm displaying the result on my form for this test using: td colspan="2" align="right"><font face="Verdana" size="2"> Test Quantity Total</td td><input type="text" size="7" name="discount_qty" onFocus="this.blur()" value="0" /></td></tr -- Legend for this post: item1_quan: form field name for quantity of item disc_quan: total quantity of all items, 2+3+1+0+0=6 I hope I have included enough info to make this understandable. Any suggestions appreciated. |
![]() |
| Thread Tools | |
| Display Modes | |
| |