如何动态加载fckeditor编辑器

soyestrellafortuna 2013-05-13 07:23:55
我想实现一个功能。使用下拉框来控制fckeditor的toolbar。

即当选择第一个选项的时候,fckeditor的toolbar是MailTemplate。而当我选择第二个下拉选项时候,页面中的fckeditor的toolbar则变成SMSTemplate。
我的页面代码是

<select id="ggTempletsType" class="common" name="ggTempletsType">
<option value="MAIL">邮件模版</option>
<option value="SMS">短信息模版</option>
</select>

<div class="right" style="float:left ;height:100%;border: 1px solid #cccccc;">
<fck:editor id="content" basePath="/common/fckeditor/"
height="500"
width="750"
skinPath="/common/fckeditor/editor/skins/silver/"
toolbarSet="MailTemplate"

</fck:editor>
</div>

<!--js-->
<script type="text/javascript">
$("#ggTempletsType").click(function() {
var oEditor = FCKeditorAPI.GetInstance("content");
if($("#ggTempletsType option:selected").val() == "MAIL"){
oEditor.ToolbarSet = "MailTemplate";
//我设置了toolbarset选项,但是不自动该如何使页面正常切换编辑器
//oEditor.ReplaceTextarea() ;
//oEditor.Create();
}else{
oEditor.ToolbarSet = "SMSTemplate";
//oEditor.ReplaceTextarea() ;

}
});

</script>


...全文
89 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
soyestrellafortuna 2013-06-03
  • 打赏
  • 举报
回复
结贴~给分~~
T9Team 2013-05-31
  • 打赏
  • 举报
回复
好像是在创建编辑框的时候就确定了吧?可以通过另外在创建一个fckedit解决,同时隐藏另外一个,或者直接将另外一个编辑框从html代码里面移除
soyestrellafortuna 2013-05-31
  • 打赏
  • 举报
回复
引用 4 楼 u010778803 的回复:
没明白到底问题是什么?是说如何变换fck的内容? fck现在已经改名ckeditor了,如果在ckedit中是这样动态变换 先将ckeditor的内容赋值给某个隐藏div中 $("#contentDiv").html(data.SERVICE_CONTENT); 将div的内容设置到ckeditor中 CKEDITOR.instances.SERVICE_CONTENT.setData($("#contentDiv").text());
我一楼的问题是想问如何根据下拉框动态的替换fckeditor的工具条?而第二个问题已经解决了。
T9Team 2013-05-29
  • 打赏
  • 举报
回复
没明白到底问题是什么?是说如何变换fck的内容? fck现在已经改名ckeditor了,如果在ckedit中是这样动态变换 先将ckeditor的内容赋值给某个隐藏div中 $("#contentDiv").html(data.SERVICE_CONTENT); 将div的内容设置到ckeditor中 CKEDITOR.instances.SERVICE_CONTENT.setData($("#contentDiv").text());
soyestrellafortuna 2013-05-29
  • 打赏
  • 举报
回复
没人回答怎么结贴啊?
soyestrellafortuna 2013-05-16
  • 打赏
  • 举报
回复
换个问题 如何给editor附默认值 editor.Value = '<bean:write name="ggTempletsDto" property="tempContext" filter="true" />';//这样写编辑器就加载不了了。
<logic:equal name="tempType" value="MAIL">
				  var editor = new FCKeditor("ggTempletsTempContext"); 
				  editor.BasePath = "/common/fckeditor/";
                  editor.Height = "500";
				  editor.Width = "700";
                  editor.ToolbarSet = "Mail";
				  editor.Value = '<bean:write name="ggTempletsDto" property="tempContext" filter="true" />';
                  editor.Create();
				 </logic:equal>
soyestrellafortuna 2013-05-14
  • 打赏
  • 举报
回复
顶一下吧~ 是重新加载fckeditor所在div的innerHTML吗? 但应该如何进行加载?

67,512

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧