文本区域中的新行 [英] New line in text area

查看:86
本文介绍了文本区域中的新行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<textarea cols='60' rows='8'>This is my statement one.\n This is my statement2</textarea>

<textarea cols='60' rows='8'>This is my statement one.<br/> This is my statement2</textarea>

我尝试了两种方法,但是新行在呈现html文件时没有反映出来。
我该怎么做?

I tried both but new line is not reflecting while rendering the html file. How can I do that?

推荐答案

试试这个:

Try this one:

<textarea cols='60' rows='8'>This is my statement one.&#13;&#10;This is my statement2</textarea>

&#10; 换行和&#13; 回车是 HTML实体 wikipedia 。这样你实际上是在解析新行(\\\
)而不是将它显示为文本。

&#10; Line Feed and &#13; Carriage Return are HTML entitieswikipedia. This way you are actually parsing the new line ("\n") rather than displaying it as text.

这篇关于文本区域中的新行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆