日期:2014-05-16  浏览次数:20355 次

js去掉字符串空格
var str = " hi! ";
var left = str.lTrim(); //结果:"hi! "
var right = str.rTrim();  //结果:" hi!"
var t = str.trim(); //结果:"hi!"
或者:
var str = " h i ! ";
str = str.replace(/[ ]/g,""); //替换所有