FCKeditor 為開源所見即所得編輯器,支援多種語言整合。下載 FCKeditor_2.6.3.zip、fckeditor-java-demo-2.4.1.zip、fckeditor-java-2.4.1-bin.zip。
FCKeditor_2.6.3.zip,將 fckeditor 資料夾複製至 WEB-INF 下。<script src="fckeditor/fckeditor.js"></script>
<script>
var oFCKeditor = new FCKeditor('FCKeditor1');
oFCKeditor.BasePath = "fckeditor/";
oFCKeditor.Width = "50%"; oFCKeditor.Height = "400";
oFCKeditor.Value = "initial value";
oFCKeditor.ToolbarSet = "Default";
oFCKeditor.Create();
</script>
<textarea name="MyTextarea">this is a value</textarea>
<script>
window.onload = function() {
var oFCKeditor = new FCKeditor('MyTextarea');
oFCKeditor.BasePath = "fckeditor/";
oFCKeditor.ReplaceTextarea();
};
</script>
第二種方式優雅降級:無 JS 環境仍可使用原生 Textarea。