PHP实例:FCKeditor的配置及使用方法.docVIP

  • 2
  • 0
  • 约3.85千字
  • 约 4页
  • 2017-06-09 发布于北京
  • 举报
〇、假设网站的目录为: 以下为引用的内容: \website_root \index.php \FCKeditor一、调用FCKeditor 的两种方法 1、通过创建实例来调用 在 index.php 文件中,调用它的代码,把下面的代码加在需要编辑器的地方: 以下为引用的内容: Form name=frm1 ?php //引用FCKeditor.php这个文件,基本的类和数据结构都在这里 include_once(FCKeditor/fckeditor.php); //创建FCKeditor对象的实例。myFCKeditor即提交后,接收数据页面 _POST[myFCKeditor]使用 FCKeditor=new FCKeditor(myFCKeditor); //FCKeditor所在的位置,这里它的位置就是FCKeditor 文件夹 FCKeditor-BasePath=./FCKeditor/; //工具按钮设置 FCkeditor-ToolbarSet=Default; //设置它的宽度 FCKeditor-Width=100%; //设置它的高度 FCKeditor-Height=300px; //生成 FCkeditor-Create(); ? /Form2、通过 IFRAME 调用 以下为引用的内容: Form name=frm1 INPUT name=myFCKeditor id=myFCKeditor style=DISPLAY: none type=hidden INPUT id=myFCKeditor___Config style=DISPLAY: none type=hidden IFRAME id=myFCKeditor___Frame src=FCKeditor/editor/fckeditor.html?InstanceName=myFCKeditoramp;Toolbar=Default frameBorder=0 width=100% scrolling=no height=300 /IFRAME /Form注意:name=myFCKeditor 和 IFRAME 中 InstanceName=myFCKeditor 的“myFCKeditor”必须相同。 其实,用 IFRAME 调用和用第一种方法本质是完全一样的!不信的话,请在用浏览器打开网站上的 index.php 文件,然后查看“源代码”,就是本 IFRAME 调用的代码。所以推荐通过创建实例来调用。 3、当用 Javascript 来获得内容的时候是不是发现得不到内容,如: script input type=button onclick=alert(document.all.frm1.myFCKeditor.value); value=GetHtml /script 你会发现弹谈出的窗口没内容。 我们可以通过下面的代码来获得它的内容: 以下为引用的内容: script function getContentValue() { var oEditor = FCKeditorAPI.GetInstance(myFCKeditor); var acontent = oEditor.GetXHTML(); return acontent; } /script input type=button onclick=alert(getContentValue());二、配置一些文件 1、fckconfig.js的配置 (1)工具按钮设置 查找 FCKConfig.ToolbarSets[Default],这里有很多按钮,下面我们将对他们详细介绍 EditSource 显示HTML源代码 StrikeThrough 删除线 Save 保存 NewPage 新建空白页面 Superscript 上标 Subscript 下标 Preview 预览 JustifyLeft 左对齐 Cut 剪切 Copy 复制 Paste 粘贴 JustifyCenter 居中对齐 JustifyRight 右对齐 JustifyFull 两端对齐 PasteText 纯文本粘贴 InsertOrderedList 自动编号 PasteWord 来自Word的粘贴 InsertUnorderedList 项目符号 Print 打印 Outdent 减少缩进 SpellCheck 拼写检查 Indent 增加缩进 Find 查找 ShowTableBorders 显示表格线 Replace 替换 ShowDetails 显示明细 Undo 撤销 Form 添加Form动作 Redo 还原 Checkbox 复选框 SelectAll 全选 Radio

文档评论(0)

1亿VIP精品文档

相关文档