js过滤前后空格 页面中添加代码 String.prototype.trim=function() { return this.replace(/(^s*)|(s*$)/g,'');} 调用:title.trim()