You could use the toFixed() method, however that only works in modern browsers. I've written three custom functions to do the same thing -- the fastest of which, I'm not sure as they are all relatively quick.
In the first function it just displays two zeros and not the actual decimal value. If total was 8.95, it displays 8.00
The other two functions display the corrent math, but give an extra zero, so it is fixed to three decimal places. I've tried playing with the code to make it only display two places, but no progress. Any idea on how to fix this?
I've discovered the issue was with Internet Explorer not treating each char of a string as a seperate value (retrieved with an array index). I've replaced it with the charAt() method, and it works in all browsers I've tested it in now.
Now all three of the scripts do not work. They are not displaying the zeros. If the chargetotal is 17.90, it displays 17.9. I tested it with IE 6 and Firefox and they both show the same error. I really appreciate all of the help!
It's not exactly showing an error, the scripts just don't work. Like I said above, if the total was 17.90, it only displays 17.9. All three of the scripts do this. I really appreciate your patience and help!