js 去除空格

  1. SCRIPT LANGUAGE="JavaScript">   
  2. <!--   
  3. //出处:网上搜集   
  4. // Trim() , Ltrim() , RTrim()   
  5. String.prototype.Trim = function()    
  6. {    
  7. return this.replace(/(^\s*)|(\s*$)/g, "");    
  8. }    
  9. String.prototype.LTrim = function()    
  10. {    
  11. return this.replace(/(^\s*)/g, "");    
  12. }    
  13. String.prototype.RTrim = function()    
  14. {    
  15. return this.replace(/(\s*$)/g, "");    
  16. }    
  17. //-->   
  18. </SCRIPT>

posted on 2008-11-18 11:00  eoiioe  阅读(325)  评论(0编辑  收藏  举报

导航