参考地址:JavaScript去除空格的三种方法[url]http://www.yaosansi.com/post/304.html[/url]
String.prototype.trim = function(){
return this.replace(/(^\s*)|(\s*$)/g, "");
}
String.prototype.trimLeft = function() {
return this.replace(/(^\s*)/g, "");
}
String.prototype.trimRight = function() {
return this.replace(/(\s*$)/g, "");
}