http://fhuan123.iteye.com/blog/1128854
转载
只要在使用trim()之前加上一句
String.prototype.trim=function(){return this.replace(/(^\s*)|(\s*$)/g,"");}
OK!!!!
本文介绍了一种在JavaScript中自定义字符串trim方法的方式,通过修改原型链实现全局字符串的前后空白去除功能。
http://fhuan123.iteye.com/blog/1128854
转载
只要在使用trim()之前加上一句
String.prototype.trim=function(){return this.replace(/(^\s*)|(\s*$)/g,"");}
OK!!!!

被折叠的 条评论
为什么被折叠?