< SCRIPT LANGUAGE = " JavaScript " > <!-- function formatFloat(src, pos) { return Math.round(src*Math.pow(10, pos))/Math.pow(10, pos);} alert(formatFloat( " 1212.2323 " , 2 )); // --> </ SCRIPT > 转载于:https://www.cnblogs.com/catxp/archive/2006/04/29/388346.html