解決方案:
var str1=aaaaaaa bbbbbbb; alert(str1); //不换行 ???不知所以然 解决办法: while (str1.indexOf("\n") >= 0) { var str2 = str1.replace("\n", " "); } 将 两边各加一个空格就ok了。 alert(str2); //换行
注意: 將" " 替換為 “\n”即可