js 脚本去除 空格 回车 换行
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);