0

我在我的网站中使用了 tiny mce 编辑器,我想在使用 tinymce 的文本区域中从数据库中加载一些文本。

编辑器的 javascript 配置如下:

<script type="text/javascript">
tinyMCE.init({
    mode : "textareas",
    theme : "advanced",
    editor_selector : "mceAdvanced",
    plugins : "style,table,iespell,preview,directionality,inlinepopups",

    // Theme options
    theme_advanced_buttons1 : "bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontsizeselect",
    theme_advanced_buttons2 : "bullist,numlist,|,outdent,indent,|,link,unlink,image,code,|,forecolor",
    theme_advanced_buttons3 : "tablecontrols",
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",

    // Example content CSS (should be your site CSS)
    content_css : "css/example.css",

    // Drop lists for link/image/media/template dialogs
    template_external_list_url : "js/template_list.js",
    external_link_list_url : "js/link_list.js",
    external_image_list_url : "js/image_list.js",
    media_external_list_url : "js/media_list.js",

    // Replace values for the template plugin
    template_replace_values : {
        username : "Some User",
        staffid : "991234"
    }
});
</script>

这就是我尝试在 textarea 中加载文本的方式:

<textarea name="program" cols="40" rows="12" class="contact_fields mceAdvanced"><? php echo $row_this_trip['program']; ?></textarea>

以下都不起作用:

<textarea name="program" cols="40" rows="12" class="contact_fields mceAdvanced">Lorem Ipsum</textarea>

或者

<textarea name="program" cols="40" rows="12" class="contact_fields mceAdvanced"><?php echo( htmlentities( $row_this_trip['program'] ) ); ?></textarea>

我找不到这有什么问题。你能帮我么?

4

2 回答 2

1

你的 html 中有指向 TinyMCE 脚本的链接吗?

<script src="linktoscript.js" type="text/javascript" />
于 2009-12-10T11:44:49.940 回答
-1

tinyMCE有一个triggerSave活动。

tinymce.triggerSave(); 

例如,

tinymce.triggerSave();

$.ajax({
        type: 'post',
        url: 'autoSaveReport.php',
        data: $('form').serialize(),
        success: function (result) {
          var redirectURL = window.location.pathname;
          var redirectURL1 = redirectURL+"?incid="+result;
            window.location = window.location+"?incid="+result;
         }
      });
于 2019-02-08T11:25:53.577 回答