Rumah > php教程 > php手册 > teks badan

调用FCKeditor的两种方法

WBOY
Lepaskan: 2016-06-06 20:00:50
asal
1149 orang telah melayarinya

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

Label berkaitan:
sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Cadangan popular
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan
Tentang kita Penafian Sitemap
Laman web PHP Cina:Latihan PHP dalam talian kebajikan awam,Bantu pelajar PHP berkembang dengan cepat!