<script language=Javascript> //自己动手为string添加Trim
String.prototype.Trim = function(){return this.replace(/^/s+|/s+$/g,"");}
String.prototype.Ltrim = function(){return this.replace(/^/s+/g, "");}
String.prototype.Rtrim = function(){return this.replace(//s+$/g, "");}
var str = " SSSSSSSSS ";
alert(str.Trim());
alert(str.Ltrim());
alert(str.Rtrim());
</script>