【问题标题】:display an html page within tinymce textarea在 tinymce textarea 中显示一个 html 页面
【发布时间】:2014-06-16 12:59:17
【问题描述】:

如何在 tinymce 文本区域中显示 HTML 页面。

<?php 

$filename = "template-3.html";
$handle = fopen($filename, "r");
$contents = fread($handle, filesize($filename));
fclose($handle);
echo $contents;

?> 

我已经使用上面的代码来显示 html 页面。但是,它只显示textarea中的文本内容,不显示html页面的图像和位置。

为了显示 html 页面,我需要做什么:

http://zurb.com/ink/downloads/templates/hero.html#

【问题讨论】:

    标签: php html email tinymce textarea


    【解决方案1】:

    您可以进行 ajax 调用并返回 html 页面,您可以将其附加到您想要的任何位置。

    <script>
        $.ajax({
            url:"http://zurb.com/ink/downloads/templates/hero.html#",
            success:function(result){
            $("#textarea").html(result);
        }});
    </script>
    

    【讨论】:

    • 对不起,朋友。我试过这个代码代码。但我没有得到结果。我只是使用 jQuery 本身在 textarea 中显示 html。
    【解决方案2】:

    以下代码在 textarea 字段中显示 html 预览。我不知道这是否是正确的实施方式。但是,我得到了我想要的结果。

     tinyMCE.activeEditor.setContent($('div div#template1').html());
    

    谢谢,

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-31
      • 1970-01-01
      • 1970-01-01
      • 2019-10-21
      • 1970-01-01
      • 2020-11-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多