带有div标签的TinyMCE?

时间:2012-11-27 13:22:05

标签: javascript html jsp tinymce

以下是我的JSP代码:

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

以下是将divTinyMCE Editor

相关联的代码
<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标签设置一些设置?

1 个答案:

答案 0 :(得分:5)

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

tinyMCE.init({
        ...
        forced_root_block : 'div'
});