// JavaScript Document
//去除左后空格
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, ""); 
} 

//使用
//document.getElementById('space').value.Trim();