首页 > 代码库 > js中去除/n/r换行

js中去除/n/r换行

replace(/\r\n/g,"").replace("\n","")

 

<script>var str = "a\r\nb\r\nc";alert(str);str = str.replace(/\r\n/g,"");alert(str);</script>

 

js中去除/n/r换行