English 中文(简体)
我能否将超文本格式放在<textarea>标签内?
原标题:Can I embed HTML formatting inside of a <textarea> tag?
  • 时间:2010-04-05 18:33:39
  •  标签:
  • html

如果我有<条码>文本区域,就如上。

<textarea name="myTextArea" cols="100" rows="20" readonly=readonly>
.. text area content ...
</textarea>

我怎么能够将超文本格式文本放在案文栏内? 如果我能看到以下工作的话......

<textarea name="myTextArea" cols="100" rows="20" readonly=readonly>
<b>Hello how are you today?</b>
</textarea>

例如。 但这一句并不大胆。 Maybe 我只是想做一些可能做的事情吗?

最佳回答

我确信答案是没有的——不能用文字来回答。

http://developer.mozilla.org/en-US/docs/Web/RUS/Element/textarea” rel=“noreferer” MDN docs:

超文本和文本处理;内容是多线文字编辑控制。

  • Permitted content Text
问题回答

不可能

<textarea> 

使用:

<div contenteditable="true">
</div>

你可以这样做(改变“特殊”性质):

<textarea name="myTextArea" cols="100" rows="20" readonly=readonly>
&lt;b&gt;Hello how are you today?&lt;/b&gt;
</textarea>

如果你在案文领域使用可调取的反响,你可以尝试这样简单不过了。

Text="&lt; stonename &gt;" 
"&lt";stonename"&gt";

你不能在文萨内这样做,但你可以做些什么......你可以使用笔子和 par子,让JQuery的标签。 与此类似:

    var stringviewinfo ="aaaaaaaaaaaaaaaaaa<br>aaaaaaaaaaaaaaaaaaaaaaaaa<br>aaaaaaaaaaaaaaaa<b>aaaaaaaa</b>aaaaaaaaaaaaaaaaaa<br>aaaaaaaaaaa<font color="red">AAAA</font>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa<b>aaaaaaaaaaaaa<b>aaaaaaaaaaaaaaaaaaaaaaaaaaaa<br>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</br>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";      
$( #viewinfo ).html(stringviewinfo);
<p style="word-wrap: break-word;" id="viewinfo"></p>

我希望这将有助于。

By now (8 years later) you know textarea is not the way to go.

If you happen to be using Vue.js, you can use a div with v-html to set the inner HTML

<template>
    <div name="myTextArea" cols="100" rows="20" readonly=readonly v-html="content" />
</template>

<script>
    export default {
        data() {
            return{
                content = "<b>Hello how are you today?</b>";
            }
    }
</script>

这里是答案。

利用这一职能。

function br2nl(varTest) {
        return varTest.replace(/<brs*/?>/ig, "
");
    }

实现这一点非常简单。

<>First>: 定制<textarea>,接受并储蓄给DB的特别果园。

<textarea contenteditable=“true”类别=“form-control” name=“ding[header_code]”><?php呼唤_(制定[标题_code], html_entity_decode($item->header_code) ?></textarea>

www.un.org/Depts/DGACM/index_spanish.htm 第二:提取和对应从获得的节省数据

<?php re html_entity_decode(config(nl2br(头盔_code ));?>

希望能帮助你们。

增 编





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签