<script   language=Javascript>  
  function   String.prototype.Trim()   {return   this.replace(/(^\s*)|(\s*$)/g,"");}   //去掉前后空格
  function   String.prototype.Ltrim(){return   this.replace(/(^\s*)/g,   "");}   //去掉左空格
  function   String.prototype.Rtrim(){return   this.replace(/(\s*$)/g,   "");}   //去掉右空格
 

//测试
var   str   =   "     Trim         ";  
  alert(str.Trim());  
  </script>  

相关文章:

  • 2021-10-15
  • 2021-08-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-20
  • 2021-09-23
相关资源
相似解决方案