解决办法:js里没有replaceall函数,因此需要用正则表示,关于回车换行的正则表示/\r\n|\n/g

(g为全局标志)

string.replace(/source/g, replaceWith);

string.replace(new RegExp( source, 'g'), replaceWith);

string:字符串表达式包含要替代的子字符串。
source:被搜索的子字符串。
replaceWith:用于替换的子字符串。

转载来自:http://blog.sina.com.cn/s/blog_446674910100ddrq.html