CreateFCK function. Example 2 of the FCKEditor in the light-open console: createfckfckeditor
Introduce the fckeditor editor entry file
<chtml file="editors/fckeditor/fckeditor.htm" />
If the user ID (user_id) in the session is blank (not logged on), a temporary ID is set to facilitate File Upload (images, etc)
<if x="@{session:user_id}"> <session><we name=user_id>0</we></session></if>
Code in the form Section
<form id="Edoit_Form" method="post" action="@{sys:path}@{sys:curPath}editor_fck_save.chtml">...</form>
Please note that the editor_fck_save.chtml web page described in the previous blog is still submitted
Add other fields
<Input name = "title" value = "your title" style = "display: none"/>
Introduce the FCKEditor editor script
SetFCKHeight (300); // editor height // setFCKTool ("Coder"); // setFCKTool ("Basic"); // setFCKValue (""); window. onload = createFCK ('content'); // use the createFCK ("content") function to create an editor. The default text domain name is "content"
Note that the function becomes createFCK ('content ')
Function for rewriting content
doReset = function (){ //document.getElementById('Edoit_Form').reset(); FCKeditorAPI.GetInstance('content').SetHTML("");}
Submitted Functions
DoSubmit = function () {// var tit = document. getElementById ('title'); // if (tit. value = "" | tit. value = "question:") // {alert ("if you have any questions, please do not hesitate! "); Tit. focus (); return;} var oEditor = FCKeditorAPI. getInstance ('content'); var oDOM = oEditor. editorDocument; var des; if (document. all) // If Internet Explorer. des = oEditor. editorDocument. body. innerText; else {// If Gecko. var r = oDOM. createRange (); r. selectNodeContents (oDOM. body); des = r. toString ();} des = des. trim (); if (des = "") {alert ("NO content, write it! "); Return;} var frm = document. getElementById (" Edoit_Form "); frm. submit ();}
Submit and override buttons
<Center> <input type = reset name = reset value = override onClick = "doReset ()"/> & nbsp; <input type = "button" value = "Submit" onClick = "doSubmit ()"/> </center>
Display Effect
All code
<Html>
(Example file: _ samples/editor/editor_fck_create.html) in the _ samples/editor directory of the Light-Open Platform
Download Easy Do IT resources
Platform and the latest development manual free download: http://download.csdn.net/detail/tx18/8721317
Development example: light open B2C e-commerce website, free download: http://download.csdn.net/detail/tx18/8318585
Light Open Platform will occasionally upgrade to provide you with more powerful and Easy functions, please pay attention to download the latest version: http://download.csdn.net/user/tx18