Click to See Complete Forum and Search --> : replace commas before summing up


vbnov
March 21st, 2008, 03:52 PM
All,

I would like to replace the commas on textbox before summing it up.

Here is the code I use.



if(!isNaN(document.getElementById(str).value)&&document.getElementById(str).value!="")

grandTotal+= parseFloat(document.getElementById(str).value);



How I can replace the commas. Help is greatly appreciated.

PeejAvery
March 22nd, 2008, 05:11 PM
A simple Google search would have shown you the replace() (http://w3schools.com/jsref/jsref_replace.asp) function.

string = string.replace(',', '');