Fckeditor是一种非常流行的所见即所得的网页编辑器。它可和PHP、JavaScript、ASP、ASP.NET、ColdFusion、Java、以及ABAP等不同的编程语言相结合。本文讲述fckeditor在ASP,PHP和JS的调用方法:
ASP调用方法:
PHP调用方法:
- <?php
- include('../fckeditor/fckeditor.php') ; //把文件包含进来
- $oFCKeditor = new FCKeditor('content') ; //表单项的名称
- $oFCKeditor->BasePath="../fckeditor/"; //编辑器所在目录
- $oFCKeditor->ToolbarSet="Yiyunnet"; //工具栏的名字
- $oFCKeditor->Height='350px'; //高度
- $oFCKeditor->Width='630px'; //宽度
- $oFCKeditor->Value=""; //初始值
- $myeditor=$oFCKeditor->CreateHtml(); //在要显示编缉器的地方输出变量$myeditor的值就行了
- ?>
ASP调用方法:
- <!-- #INCLUDE file="../FCKeditor/FCKeditor.asp" -->
- <%
- Dim oFCKeditor
- Set oFCKeditor = New FCKeditor
- oFCKeditor.BasePath = "../FCKeditor/"
- oFCKeditor.ToolbarSet = "Yiyunnet"
- oFCKeditor.Width = "100%"
- oFCKeditor.Height = "300"
- oFCKeditor.Value = ""
- oFCKeditor.Create "Content" 'Content是表单项的名称,这里直接显示编辑器
- %>
FCKeditor js调用方法①
- <script src="fckeditor/fckeditor.js"></script>
- <script type="text/javascript">
- var oFCKeditor = new FCKeditor( 'Content' ) ;
- oFCKeditor.BasePath = 'fckeditor/' ;
- oFCKeditor.ToolbarSet = 'Basic' ;
- oFCKeditor.Width = '100%' ;
- oFCKeditor.Height = '400' ;
- oFCKeditor.Value = '' ;
- oFCKeditor.Create() ;
- </script>
FCKeditor js调用方法②
- <script src="fckeditor/fckeditor.js"></script>
- <script type="text/javascript">
- function showFCK(){
- var oFCKeditor = new FCKeditor('Content') ;
- oFCKeditor.BasePath = 'fckeditor/' ;
- oFCKeditor.ToolbarSet = 'Basic' ;
- oFCKeditor.Width = '100%' ;
- oFCKeditor.Height = '200' ;
- oFCKeditor.Value = '' ;
- oFCKeditor.ReplaceTextarea() ;
- document.getElementById("btnShow").disabled = 'true';
- document.getElementById("btnShow").style.display = 'none';
- }
- </script>
- <textarea name="Content"></textarea>
- <input id=btnShow style="display:inline" type=button οnclick="showFCK()">
转载于:https://blog.51cto.com/movie0312/216008