CreateFCK function. Example 2 of the FCKEditor in the light-open console: createfckfckeditor

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.