Calling through JavaScript
First step: Copy the FCKeditor resource folder to Webroot
Step two: fetching JavaScript files
<script type= "Text/javascript" src= "Fckeditor/fckeditor.js" ></script>
Step three: Output code for JavaScript calls.
Method One: Create and enter an editor.
<script type= "Text/javascript" >
* Create a FCKeditor instance called ' FCKeditor1 '
var ofckeditor = new FCKeditor (' FCKeditor1 ');
The *basepath Editor's baseline path defaults to:/fckeditor/
Represents the path of the current site: http://localhost:8080/fckeditor/
So the path is:/Engineering name/fckeditor/, example: (/fcktese/fckeditor/)
Ofckeditor.basepath = "/fcktest/fckeditor/";
Ofckeditor.width= "60%";
ofckeditor.height= "500";
Ofckeditor.toolbarset= "Basic";
Create FCKeditor
Ofckeditor.create ();
</script>
Method Two: Replace a testarea element with an editor
Add the following code to the head:
<script type= "Text/javascript" >
Window.onload = function ()
{
Mytextarea is the name of the textarea
var ofckeditor = new FCKeditor (' Mytextarea ');
Ofckeditor.basepath = "/fcktest/fckeditor/";
Ofckeditor.replacetextarea ();
}
</script>
Add the following code to the body:
<textarea id= "Mytextarea" name= "Mytextarea" ></textarea>
Note: 1. BasePath to set up correctly
2.BasePath must end with '/'
Properties of the FCKeditor object
Property name
|
Description
|
Default Value |
Width |
Width |
100% |
Height |
Height |
200 |
Value |
Editor initialization content |
(empty string) |
ToolbarSet |
The name of the toolbar collection (built-in default and basic, or custom) |
Default |
BasePath |
Base Path of editor |
/fckeditor/ |
The construction method of FCKeditor
Builder:
Var fckeditor=function (Instancename,width,height,toolbarset,value)
where InstanceName is the value of the Name property of the textarea element that is output by the editor, you must make
parameter is assigned to the property with the same name
Calling FCKeditor through custom tags in a JSP
The first step is to add a jar package under Lib
Commons-fileupload-1.2.1.jar and Commons-io-1.3.2.jar for uploading and downloading
Java-core-2.4.1.jar for FCKeditor Core pack
Slf4j-api-1.5.2.jar as Log
§ Step two: Copy the FCKeditor resource folder to the Webroot
§ Create a custom label in the third step
<%@ taglib uri= "http://java.fckeditor.net" prefix= "FCK"%>
§ Step fourth refers to FCKeditor
<fck:editor instancename= "user" basepath= "/fckeditor" width= "70%" height= "value =" "></FCK:editor>
BasePath: The '/' begins with '/' to represent the path of the current project, so use the default to
InstanceName: Must specify
The Value property must be specified in the old version and cannot be an empty string.