textArea换行符转 <br/>
textarea标签回车符是/n,在html里识别回车是<br/>,在存入数据库之前要进行转换成<br/>,在取出展示在html页面时才能显示换行。
<tr> <td align=right width="20%" height="100">备注:</td> <td><textarea name="beiz" id="beiz" class="textarea" style="80%;height:80px;"></textarea></td> </tr>
在提交前存入数据库前转换一下
<script lanuage="javascript">
var descrip = $("#beiz").val();
descrip=descrip.replace(/
/g,'<br />');
$("#beiz").val(descrip);
</script>
这样存进数据库就是<br/>
<br/> 转 textArea换行符
span_html = $("#test_span").html()
"测试<br>测试<br>测试<br>测试<br>"
text_area = $("#222");
n.fn.init [textarea#222, context: document, selector: "#222"]
text_area.val();
""
text_area.val(span_html.replace(/<br>/g,"
"))
n.fn.init [textarea#222, context: document, selector: "#222"]
