function fix(num, N) {
var base = Math.pow(10, N);
return Math.round(num * base) / base;
}

 实例,取小数后边两位

  var yhmoney2 = fix(1.22222, 2);

jQuery去掉字符串首尾空字符串

str=str.replace(/(^\s*)|(\s*$)/g, "")

 

posted on 2018-06-28 17:04  许一朵岁月  阅读(686)  评论(0编辑  收藏  举报