textArea 输入字符串中有换行符时,没有自动转换

ggyy1031 2011-02-12 11:20:44
textArea输出字符串时,没有自动转换其中的换行符,比如字符串“fdafdsa\r\nfdsaf”在textArea中输出为“fdafdsa\r\nfdsaf”
...全文
237 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
ggyy1031 2011-02-12
  • 打赏
  • 举报
回复
在百度找到答案了,谢谢大家
ggyy1031 2011-02-12
  • 打赏
  • 举报
回复
我是xml里读过来的字符串,比如
<node text="fdsafdsafads\r\ndsfafasdf"/>

textarea.text = "node.@text";
这样,里面的换行符解析不出来。

xlgp2171 2011-02-12
  • 打赏
  • 举报
回复
可以这样写
<s:TextArea id="textarea" />
在Script中
textarea.text = "fdafdsa\r\nfdsaf";
就可以看到换行了
ggyy1031 2011-02-12
  • 打赏
  • 举报
回复
就不能不用html标签吗?用html标签的话是能写,但是毕竟是两种语言,怕以后会有问题
liuyyuns 2011-02-12
  • 打赏
  • 举报
回复
在textarea中的换行不是你那样写的,看看下面的:

<mx:TextArea width="400" height="100">
<mx:htmlText><![CDATA[This is <font color="#FF0000">换行</font><br> in a <b>TextArea control</b>. Use the <u>htmlText property</u> of the <font color="#008800">TextArea control</font> to include basic HTML markup in your text.]]></mx:htmlText>
</mx:TextArea>

4,327

社区成员

发帖
与我相关
我的任务
社区描述
多媒体/设计 Flex
社区管理员
  • Flex
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧