Is the Javascript parser later than 1.5? Then you can use a nice built-in function: toFixed()

Like so:

var v = 25.567;

return v.toFixed(2);

(which will return 25.56)

Again, this is specifically for later JS implementations.

Oh BTW, if you need a function for earlier JS, I'm sure I have something - I used to use the Math.Round() function (which rounded up to the nearest int) with a little creative math to pad the decimal places (simple * and / by a factor of 10).

Also you might want to check for a numeric value (isNan(), or parse out the numeric portion parseInt(), or parseFloat()).