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);

 

posted @ 2012-07-05 17:33  一修先生  阅读(32705)  评论(1编辑  收藏  举报