js去除空格

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

  

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