Maison > php教程 > php手册 > le corps du texte

调用FCKeditor的两种方法

WBOY
Libérer: 2016-06-06 20:00:50
original
1150 Les gens l'ont consulté

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; 
  } 

Étiquettes associées:
source:php.cn
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Recommandations populaires
Tutoriels populaires
Plus>
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!