javascript解决IE8一下浏览器不支持trim属性的兼容性问题
if(!String.prototype.trim){ String.prototype.trim=function(){ return this.replace(/^\s+|\s$/g,""); } }
例:var str=" Hello Javascript ";
str=str.trim();
document.write(str);
if(!String.prototype.trim){ String.prototype.trim=function(){ return this.replace(/^\s+|\s$/g,""); } }
例:var str=" Hello Javascript ";
str=str.trim();
document.write(str);