先down一個FckEdit源文件壓縮包.
將其解壓縮到你的網站目錄的文件夾下.我使用的是tomcat,則解壓到webapps/的某個文件夾下,特別要注意的是解壓完了要看一下你解壓的包中的那個fckeditor.js在什么位置.
在網頁中創建一個textarea,一定要命名其id.
應用Fckeditor.
<script language="javascript" type="text/javascript" src="你的fckeditor.js所在的位置/fckeditor.js"></script>
<script language="javascript" type="text/javascript">
window.onload = function() {
var oEditor = new FCKeditor('你命名的Textarea的Id','700px','300px') ;
oEditor.BasePath= 'FCKeditor所處的相對站點的路徑/FCKeditor/' ;
oEditor.ToolbarSet="設置工具欄";//可選的參數可以在fckeditor.js位置相同的文件夾中的fckconfig.js中找到也可以設置自己需要的Toolbar
oEditor.ReplaceTextarea() ;
}
function copyIt(){
var oEditor = FCKeditorAPI.GetInstance('你命名的Textarea的Id');
oEditor.UpdateLinkedField();
window.clipboardData.setData("Text", document.getElementById("你命名的Textarea的Id").innerHTML);
} </script>