5

下面是我的 JSP 代码:

<tr>
      <td colspan="2">custEmail</td>
      <td colspan="5"><div id= "custEmail"><p><strong>Test</strong></p></div></td>
</tr>

下面是div使用TinyMCE 编辑器附加的代码

<script type="text/javascript" src="tinymce/tinymce.min.js"></script>
<script type="text/javascript">
tinyMCE.init({
        width : "640",
        mode : "exact",
        elements : "custEmail",
        theme : "advanced",
        plugins : "preview",
        readonly : true,
        theme_advanced_buttons1 : "forecolor,backcolor,|,justifyleft,justifycenter,justifyright,justifyfull,|,bullist,numlist,|,formatselect,fontselect,fontsizeselect,sub,sup,|,bold,italic,underline,strikethrough",
        theme_advanced_buttons2 : "",
        theme_advanced_buttons3 : "",
        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
        theme_advanced_statusbar_location : "bottom",
        theme_advanced_resizing : true
    });
</script>

但是在我的 HTML 页面上,我看到的内容是:

<p><strong>Test</strong></p>

而不是大胆的测试。只要我更改以下内容:

div id="custEmail" tag to textarea id="custEmail"

它工作正常。不确定我是否需要对 div 标签进行一些设置?

4

1 回答 1

5

您需要做的就是将forced_root_block设置为'div'

tinyMCE.init({
        ...
        forced_root_block : 'div'
});
于 2012-11-27T13:26:01.707 回答