Javascript sum currency amounts

I have the following routine that generates a "running total" of checkbox menu items (employee concessions), but it is running into two problems: (1) The first item checked does not appear unless another mouse-click is made on the screen, and (2) even though all amounts are currency, the total will occasionally display a bunch of decimal positions (e.g.,  10.59 + 2.25 displays as 12.8300000009).  
Here is the little function:
function checkTotal() {
	document.frmPost.runningTotal.value = '';
	var sum = 0;
	for (i=0;i<document.frmPost.Concession.length;i++) {
	  if (document.frmPost.Concession[i].checked) {
	  	sum = Number(Number(sum) + Number(document.frmPost.Concession[i].value));
	document.frmPost.runningTotal.value = '$' + sum;

Open in new window

And the field that it is being displayed inside of is defined as:
<input name="runningTotal" type="text">

Open in new window

Any insights would be very much appreciated!
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kevin CrossChief Technology OfficerCommented:
For the second issue, you can try sum.toFixed(2).  For the first issue (if I understand correctly), you need to trap on the mouse events if you want to see changes before the user changes focus.
Dave BaldwinFixer of ProblemsCommented:
JavaScript has only integer and floating point arithmetic.  There are many decimal values that can not be exactly represented by floating point arithmetic which is why you get the long decimal numbers at times.  To get two decimal places in your display, use the toFixed() Method shown on this page:  The 'Tryit' demo makes it clearer.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
OGSanAuthor Commented:
Super responses!  Thanks SO much for the clear and concise assist.  I changed the ONCHANGE to ONCLICK to fix the first problem, and modified the final line of code in my routine to "sum.toFixed(2)" and all is GOLDEN!  Thank you both for the help!
Dave BaldwinFixer of ProblemsCommented:
You're welcome, glad to help.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.