first of all: Congratulations on using the [ CODE ] tags in the first post. That's rare.
function expect an object as the argument, but you don't pass anything when calling them. You use the return values of the function, but they don't have any return value. And what is the eval()
supposed to do?? Don't use eval()
unless you really, truly know what you're doing.
I think it might be a good idea to start from scratch. Before you start writing down code, make of concept of what you wanna do and how you wanna implement it. While you program, test each functionality before moving on to the next one. This way you'll notice errors very early and don't end up with a whole script of broken code.
By the way, is there any reason why you distinguish between ShowTotal()
? In the code you posted, it's completely useless, because you add up the values, anyway.
Personally, I'd approach this in a different way: Make a single
function for calculating the total and bind it to the "onchange" event of the input fields. In the function, loop through all fields and add up the values (you only need to account for checked boxes). After that, display the total.