ASP PHP JS調用fckeditor的方法

Fckeditor是一種很是流行的所見即所得的網頁編輯器。它可和PHP、JavaScript、ASP、ASP.NET、ColdFusion、Java、以及ABAP等不一樣的編程語言相結合。本文講述fckeditor在ASP,PHP和JS的調用方法:
  PHP調用方法:
  
  
  
  
  1. <?php  
  2. include('../fckeditor/fckeditor.php') ;  //把文件包含進來
  3. $oFCKeditor = new FCKeditor('content') ;  //表單項的名稱
  4. $oFCKeditor->BasePath="../fckeditor/";  //編輯器所在目錄
  5. $oFCKeditor->ToolbarSet="Yiyunnet";  //工具欄的名字
  6. $oFCKeditor->Height='350px';  //高度
  7. $oFCKeditor->Width='630px';  //寬度
  8. $oFCKeditor->Value="";  //初始值
  9. $myeditor=$oFCKeditor->CreateHtml();  //在要顯示編緝器的地方輸出變量$myeditor的值就好了
  10. ?>

ASP調用方法:
  
  
  
  
  1. <!-- #INCLUDE file="../FCKeditor/FCKeditor.asp" -->
  2. <%  
  3. Dim oFCKeditor  
  4. Set oFCKeditor = New FCKeditor  
  5. oFCKeditor.BasePath = "../FCKeditor/"
  6. oFCKeditor.ToolbarSet = "Yiyunnet"
  7. oFCKeditor.Width = "100%"
  8. oFCKeditor.Height = "300"
  9. oFCKeditor.Value = ""
  10. oFCKeditor.Create "Content"   'Content是表單項的名稱,這裏直接顯示編輯器  
  11. %>

  FCKeditor js調用方法①
  
  
  
  
  1. <script src="fckeditor/fckeditor.js"></script>  
  2. <script type="text/javascript">  
  3. var oFCKeditor = new FCKeditor( 'Content' ) ;  
  4. oFCKeditor.BasePath = 'fckeditor/' ;  
  5. oFCKeditor.ToolbarSet = 'Basic' ;  
  6. oFCKeditor.Width = '100%' ;  
  7. oFCKeditor.Height = '400' ;  
  8. oFCKeditor.Value = '' ;  
  9. oFCKeditor.Create() ;  
  10. </script>
  FCKeditor js調用方法②
  
  
  
  
  1. <script src="fckeditor/fckeditor.js"></script>  
  2. <script type="text/javascript">  
  3. function showFCK(){  
  4. var oFCKeditor = new FCKeditor('Content') ;  
  5. oFCKeditor.BasePath = 'fckeditor/' ;  
  6. oFCKeditor.ToolbarSet = 'Basic' ;  
  7. oFCKeditor.Width = '100%' ;  
  8. oFCKeditor.Height = '200' ;  
  9. oFCKeditor.Value = '' ;  
  10. oFCKeditor.ReplaceTextarea() ;  
  11. document.getElementById("btnShow").disabled = 'true';  
  12. document.getElementById("btnShow").style.display = 'none';  
  13. }  
  14. </script>  
  15. <textarea name="Content"></textarea>  
  16. <input id=btnShow style="display:inline" type=button onclick="showFCK()">
相關文章
相關標籤/搜索