如果是前台TEATAREA提交的话,因为IE和FF对换行的处理不同,IE下是 回车+换行 ,FF下是 换行,所以处理方法应该是
var str = ''; //你的字符串
str = str.replace(/\r\n/g,"
")
str = str.replace(/\n/g,"
");
console.log(str);
str=str.replace("\r\n","
");
str=str.replace("\n","
");
str=str.replace(/\r\n/,"
\r\n
");var obj="weclome to my blog!";
var newobj=obj.replace("my","our");
alert(newobj);