【问题标题】:fckeditor does not show the textareafckeditor 不显示文本区域
【发布时间】:2013-07-13 10:40:01
【问题描述】:

我正在为我的项目做管理面板,但是用FCKEDITOR 编辑的textarea 没有显示。

我得到以下来源:

<input type="hidden" id="text" name="text" value="here shows the text itself....." style="display:none" />
<input type="hidden" id="text___Config" value="" style="display:none" />
<iframe id="text___Frame" src="fckeditor/editor/fckeditor.html?InstanceName=text&amp;Toolbar=Default" width="890" height="600" frameborder="0" scrolling="no">
</iframe><br>

【问题讨论】:

  • 如果您要进行新开发,请使用名为ckedtior的新版本。
  • 我认为你已经从 HTML 的view source 复制了你的代码。阅读我的答案,我已经完整描述了如何将 FCKEditor 与您的代码集成。

标签: hidden fckeditor


【解决方案1】:

集成 FCKEditor

第 1 步
首先要做的是在页面中包含“JavaScript 集成模块”脚本,就像这样:

<script type="text/javascript" src="fckeditor/fckeditor.js"></script>

第 2 步
现在 FCKeditor 类可用并且可以使用了。在您的页面中创建 FCKeditor 有三种方法:

方法一
内联方法(首选):转到您的页面正文,到您希望编辑器所在的位置(通常在表单内)并将以下脚本放在那里:

<script type="text/javascript">
var oFCKeditor = new FCKeditor('FCKeditor1');
oFCKeditor.BasePath = "/fckeditor/";
oFCKeditor.Create();
</script>

方法二
TEXTAREA替换方法:

在添加“onload”方法:

<script type="text/javascript">
window.onload = function()
{
var oFCKeditor = new FCKeditor( 'MyTextarea' ) ;
oFCKeditor.BasePath = "/fckeditor/" ;
oFCKeditor.ReplaceTextarea() ;
}
</script>

添加以下代码以替换页面中现有的 TEXTAREA:

<textarea id="MyTextarea" name="MyTextarea">This is <b>the</b> initial value.</textarea>

方法3
CreateHtml() 方法(用于 AJAX):对于 AJAX 应用程序,您将动态设置内部 html;例如:

var div = document.getElementById("myFCKeditor");
var fck = new FCKeditor("myFCKeditor");
div.innerHTML = fck.CreateHtml();

示例代码
示例代码 1

<html>
<head>
<title>FCKeditor - Sample</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="robots" content="noindex, nofollow">
<script type="text/javascript" src="fckeditor/fckeditor.js"></script>
</head>
<body>
<form>
<script type="text/javascript">
var oFCKeditor = new FCKeditor('FCKeditor1');
oFCKeditor.BasePath = "/fckeditor/";
oFCKeditor.Create();
</script>
</form>
</body>
</html>

示例代码 2

<html>
<head>
<title>FCKeditor - Sample</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="robots" content="noindex, nofollow">
<script type="text/javascript" src="fckeditor/fckeditor.js"></script>
<script type="text/javascript">
window.onload = function()
{
var oFCKeditor = new FCKeditor( 'MyTextarea' ) ;
oFCKeditor.BasePath = "/fckeditor/" ;
oFCKeditor.ReplaceTextarea() ;
}
</script>
</head>
<body>
<textarea id="MyTextarea" name="MyTextarea">This is <b>the</b> initial value.</textarea>
</body>
</html>

Source site

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-03-20
    • 1970-01-01
    • 1970-01-01
    • 2021-10-31
    • 2020-03-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多