日期:2014-05-16 浏览次数:20450 次
<script language=Javascript> //自己动手为string添加Trim 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 = " aaa "; alert(str.Trim()); </script>