//四舍五入保留2位小数(若第二位小数为0,则保留一位小数) function keepTwoDecimal(num) { var result = parseFloat(num); if (isNaN(result)) { alert('传递参数错误,请检查!'); return false; } result = Math.round(num * 100) / 100; return result; } //四舍五入保留2位小数(不够位数,则用0替补) function kee…
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>floatDecimal.html</title> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta htt…