javascript 保留小数 //num表示要四舍五入的数,v表示要保留的小数位数。function decimal(num,v){ var vv = Math.pow(10,v); return Math.round(num*vv)/vv;}