js字符替换将<br>替换成/n
显示在textarea,正则如何写
mystring.replace(/ <br> /g, '\n ')
不行怎么弄?
------解决方案-------------------- <textarea id= "text " rows= "6 ">
aaa <br> bbb <br /> ccc <br />
</textarea>
<input type= "button " value= "ok " onclick= "mm() " />
<SCRIPT LANGUAGE= "JavaScript ">
<!--
function mm()
{
var e = document.getElementById( "text ");
e.value = e.value.replace(/ <br\s*\/?> /g, "\n ");
}
//-->
</SCRIPT>