|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
How to calculate the total price using javascript
Hello, friends. I Have table like
quantity size price total 1-10 large £15 changed as the quantity increase 1-10 Middle £15 .... 1-10 Smalss £15 ..... total price sum of this column I could be able use function QuantityChangedL(qty) { document.getElementById ('totalL').innerHTML = qty * document.getElementById ('price').innerHTML }...... to get the each row's total value there, but how should I make the code so that the last row's total price can change according too! Thanks very much in advance!! |
|
#2
|
|||
|
|||
|
You can create a variable that keeps an incrementing value (total)... Anytime your values change, you increase/decrease the value of the totals variable accordingly.
total = total - (change) or total = total + (change) Does that make sense?
__________________
____________________________________________ Developer Shed Weekly Writer | DevArticles Forum Moderator Build Your Own KlipFolio Klip With PHP FrankManno.com - Under Construction Design Interactive Group - Under Construction |
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > How to calculate the total price using javascript |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|