...

View Full Version : document.autoSum question



Len Whistler
10-22-2005, 05:42 AM
I have a form with text boxes that hold formatted currency numbers such as 234.50, 34.50, 1,234.78. They update real time when the QTY is entered.

I also have a SUB-TOTAL and TOTAL box's that instantly update with the total from the above text boxes. Everything works fine as long as there is no commas in the numbers, like 34.50 or 34.77 and so on. BUT if a number with a comma like 12,345.99 shows up then I get NaN in the SUB-TOTAL and TOTAL box's. The commas screw everything up.

I am using document.autoSum and assume that autoSum does not recognize commas as a number. What can I replace document.autoSum with to add numbers with commas?

Thanks

Philip M
10-22-2005, 08:01 AM
You can strip the commas using a regular expression

theNumber=theNumber.replace(/,/g,"")



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum