I tested the below script and it worked fine in IE and Firefox var visitorName = "Chuck"; var myOldString = "Hello username! I hope you enjoy your stay username."; var myNewString = myOldString.replace("username", visitorName); document.write("Old string = " + myOldString); document.write("<br />New string = " + myNewString);
Johndas wrote:
total = total.replace(/,/,'');
Why your are using two commas, that means you are passing three arguments to function. Where replace accepts only two.