主页 M

js 脚本去除 空格 回车 换行

2015-08-13 网页编程网 网页编程网
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);
阅读原文
阅读 3905
123 显示电脑版