Jump to content


Real time calculation via javascript

  • Please log in to reply
1 reply to this topic

#1 fezzik

  • Members
  • PipPipPip
  • Advanced Member
  • 42 posts

Posted 25 October 2006 - 09:56 PM

I'm looking for assistance with creating a method that displays a total on a page without requiring form submission. Basically I have a list of  items that are populated from a db query using php. I list the item name, quantity field, item price, item total and grand total. Similar to:

Mishra's Workshop      [INPUT QUANTITY]    $250.00    [TOTAL]
                                                                  [GRAND TOTAL]

When you change the quantity I would like the total to reflect the change without having to submit the form. I would also like the grand total to behave the same as total. Is it possible to use javascript to accomplish this? If so, can you please give me an example or a link with more details. If you need more information let me know.



#2 fenway

  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 26 October 2006 - 05:15 PM

Sure... you just need to have unique IDs/names for each element you want totalled, a JS hash with the lookups, and then some simple math.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users