如:追加去空格函数
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()