JS去除空格

去除所有空格:  
  str   =   str.replace(/\s+/g,"");  
   
  去除两头空格:  
  str   =   str.replace(/^\s+|\s+$/g,"");
posted on 2008-06-11 17:21  上校  阅读(1602)  评论(1编辑  收藏  举报