function iGetInnerText(testStr) {
var resultStr = testStr.replace(/\ +/g, ""); //去掉空格
resultStr = testStr.replace(/[ ]/g, ""); //去掉空格
resultStr = testStr.replace(/[\r\n]/g, ""); //去掉回车换行
return resultStr;
}
//这样使用
var testStr="
sssss
vvvvv
";
var result=iGetInnerText(testStr); 当前位置:主页 >> JavaScript >> 正文
js 脚本去除 空格 回车 换行
阅读:4152 输入:2015-08-13 12:36:22