我想实现一个功能。使用下拉框来控制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>
------解决方案--------------------
没明白到底问题是什么?是说如何变换fck的内容?
fck现在已经改名ckeditor了,如果在ckedit中是这样动态变换
先将ckeditor的内容赋值给某个隐藏div中
$("#contentDiv").html(data.SERVICE_CONTENT);
将div的内容设置到ckeditor中
CKEDITOR.instances.SERVICE_CONTENT.setData($("#contentDiv").text());