Fckeditor是一種很是流行的所見即所得的網頁編輯器。它可和PHP、JavaScript、ASP、ASP.NET、ColdFusion、Java、以及ABAP等不一樣的編程語言相結合。本文講述fckeditor在ASP,PHP和JS的調用方法:
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();
- ?>
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 onclick="showFCK()">