开发者

how to show <html> in textarea

In textarea, I load text from database and then show in textarea. I have a problem, textarea not show &lt; and &gt;. It has been changed开发者_如何转开发 to < and > .

<textarea>&gt;html&gt;</textarea>

in textarea , change to . I want to show &lt;html&gt; , how to make it ?


Escape the & by using &amp;.

Change this:

<textarea>&lt;html&gt;</textarea>

To this:

<textarea>&amp;lt;html&amp;gt;</textarea>

If you're using PHP you can automatically do this with htmlspecialchars().


You may also want to use the Entity Number. It depends on the page character set. For ISO-8859-1 you would do "&#60(semicolon)" and "&#62(semicolon)". replace the "(semicolon)" part with ; ... This just shows that this page supports it too :)

For a complete list view HTML ISO-8859-1 Reference

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜