search
Homephp教程php手册调用FCKeditor的两种方法

1、通过创建实例 在这里只写调用它的代码了,网站的其他代码当然由你自己写了,把下面的代码加在需 要编辑器的地方: ?php include_once("FCKeditor/fckeditor.php");//引用 FCKeditor.php 这个文件 $FCKeditor=new FCKeditor('welefen');//创建 FCKeditor

1、通过创建实例 

    在这里只写调用它的代码了,网站的其他代码当然由你自己写了,把下面的代码加在需
要编辑器的地方:

  include_once("FCKeditor/fckeditor.php");//引用 FCKeditor.php 这个文件 
 $FCKeditor=new FCKeditor('welefen');//创建 FCKeditor 对象的实例 
 $FCKeditor->BasePath='FCKeditor/';//FCKeditor 所在的位置,这里它的位置就是
 'FCKeditor/'; 
 $FCkeditor->ToolbarSet='Default'; //工具按钮设置 
 $FCKeditor->Width='100%'; //设置它的宽度 
 $FCKeditor->Height='300px'; //设置它的高度 
 $FCkeditor->Create(); 
 ?> 

2、通过 iframe 调用创建 

     在你认为该加的地方加上
  
  
  src="FCKeditor/editor/fckeditor.html?InstanceName=welefen&Toolbar=Defaul
 t" frameBorder=0 width=100% scrolling=no height=300> 
  

3、对上述两种方法的说明

     在上述两种方法中,你都看到了字符串'welefen',你可能不知道是什么意思,现在我
给你解释一下,如果你要将文本编辑器中的内容在另外一个页面显示或者要将在它保存在数
据库,你可以用$_POST['welefen']或者用$_GET['welefen']来获取文本编辑器中的内容,
具体是用 post 还是用 get 那要看你用的是什么传递方法了,当然你也可以把 welefen 改
成你想要用的,如'content'.

     如果你还不知道什么是 ajax,那么这一段话你就不用看了。

     当你用ajax 的来获得内容的时候是不是发现得不到内容,如:
     <script>alert(document.form.content.value)</script>你会发现谈出的窗口
没内容
     那么我们可以通过下面的代码来获得它的内容:

 function getContentValue() 
  { 
     var oEditor = FCKeditorAPI.GetInstance('content') ; 
     var acontent=oEditor.GetXHTML(); 
     return acontent; 
  } 

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.