js去除空格

function trim(str){
  return str.replace(/(^\s*) | ( \s*$ )/g,"" );
}

  

posted @ 2015-06-04 19:22  a757956132  阅读(100)  评论(0编辑  收藏  举报