It can be combined with different programming languages such as PHP, JavaScript, ASP, ColdFusion, Java, and ABAP. The configuration and use of FCK are very simple, but the default configuration cannot meet all needs, so we need to understand some advanced FCK functions.
Get an instance of FCK
FCKeditor API is a global object registered after FCKeditor is loaded. Using it, we can complete various operations on the editor.
Obtain an FCK editor instance on the current page:
var Editor = ('InstanceName');
Obtain an FCK editor instance from the pop-up window of the FCK editor:
var Editor = ().FCK;
Get an FCK editor instance for other subframes from the subframes of the frame page:
var Editor = ('InstanceName');
Get the FCK editor instance of the parent window from the page popup:
var Editor = ('InstanceName');
FCK Get Focus
Get whether the focus is in the FCK:
FCK Get Focus:
();//Get focus
Get and set the content of FCK
Get the contents of the FCK editor:
(formatted); // formatted is: true|false, indicating whether to be removed in HTML format.
Set the contents of the FCK editor:
("content", false); // The second parameter is: true|false, whether to set its content in the form of what you see, that is, what you get.
Insert content into the FCK editor:
("html"); // "html" is HTML text
Check if the FCK editor content has changed:
();
// Get HTML content in the editor
function getEditorHTMLContents(EditorName) {
var oEditor = (EditorName);
return((true));
}
// Get the Chinese content of the editor
function getEditorTextContents(EditorName) {
var oEditor = (EditorName);
return();
}
// Set content in the editor
function SetEditorContents(EditorName, ContentStr) {
var oEditor = (EditorName) ;
(ContentStr) ;
}
FCK event handling
FCK defines events such as OnComplete, OnBlur and OnFocus, so that the corresponding processing can be completed using the event's handling function.
The method of adding event handler function in FCK is: ( EventName, function)
Code
//How to process after FCKeditor is loaded
function FCKeditor_OnComplete( editorInstance )
{
( 'OnBlur' , FCKeditor_OnBlur ) ;
( 'OnFocus', FCKeditor_OnFocus ) ;
}
function FCKeditor_OnBlur( editorInstance )
{
//Lost focus Collapse toolbar
() ;
}
function FCKeditor_OnFocus( editorInstance )
{
() ;
}
Get an instance of FCK
FCKeditor API is a global object registered after FCKeditor is loaded. Using it, we can complete various operations on the editor.
Obtain an FCK editor instance on the current page:
var Editor = ('InstanceName');
Obtain an FCK editor instance from the pop-up window of the FCK editor:
var Editor = ().FCK;
Get an FCK editor instance for other subframes from the subframes of the frame page:
var Editor = ('InstanceName');
Get the FCK editor instance of the parent window from the page popup:
var Editor = ('InstanceName');
FCK Get Focus
Get whether the focus is in the FCK:
FCK Get Focus:
();//Get focus
Get and set the content of FCK
Get the contents of the FCK editor:
(formatted); // formatted is: true|false, indicating whether to be removed in HTML format.
Set the contents of the FCK editor:
("content", false); // The second parameter is: true|false, whether to set its content in the form of what you see, that is, what you get.
Insert content into the FCK editor:
("html"); // "html" is HTML text
Check if the FCK editor content has changed:
();
Copy the codeThe code is as follows:
// Get HTML content in the editor
function getEditorHTMLContents(EditorName) {
var oEditor = (EditorName);
return((true));
}
// Get the Chinese content of the editor
function getEditorTextContents(EditorName) {
var oEditor = (EditorName);
return();
}
// Set content in the editor
function SetEditorContents(EditorName, ContentStr) {
var oEditor = (EditorName) ;
(ContentStr) ;
}
FCK event handling
FCK defines events such as OnComplete, OnBlur and OnFocus, so that the corresponding processing can be completed using the event's handling function.
The method of adding event handler function in FCK is: ( EventName, function)
Code
Copy the codeThe code is as follows:
//How to process after FCKeditor is loaded
function FCKeditor_OnComplete( editorInstance )
{
( 'OnBlur' , FCKeditor_OnBlur ) ;
( 'OnFocus', FCKeditor_OnFocus ) ;
}
function FCKeditor_OnBlur( editorInstance )
{
//Lost focus Collapse toolbar
() ;
}
function FCKeditor_OnFocus( editorInstance )
{
() ;
}