Using the FCKeditor control in a JSP page

Source: Internet
Author: User
Tags zip

FCKeditor is a WYSIWYG text editor that is specifically designed to be in the open source code on a Web page. It is focused on lightweight and does not require too complex installation steps to be used. It can be combined with different programming languages such as PHP, JavaScript, ASP, ASP.net, ColdFusion, Java, and ABAP. The "FCK" in the "FCKeditor" name is the initials of the author of this editor Frederico Caldeira Knabben.

FCKeditor control please go to the official website to download http://www.fckeditor.net, this example is mainly used to Fckeditor_2.6.3.zip, Fckeditor-java-demo-2.4.1.zip, Some of the content inside the fckeditor-java-2.4.1-bin.zip, readers can download themselves.

1. Unpack the compressed package fckeditor_2.6.3.zip, copy the FCKeditor folder to the Web-inf below, which can be used directly after.

2. There are two ways to use FCKeditor in a page.

Mode one: the way of JavaScript

(1) Direct use, see method1.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<script type="text/javascript" src="fckeditor/fckeditor.js"></script>
<body>
方法一:通过JavaScript来实现的实现编辑器导入<br>
<script type="text/javascript">
var oFCKeditor = new FCKeditor('FCKeditor1') ;
oFCKeditor.BasePath = "fckeditor/";
//oFCKeditor.BasePath   = "/FCKEditTest/fckeditor/";
oFCKeditor.Width="50%";
oFCKeditor.Height="400";
oFCKeditor.Value="initial value";
//oFCKeditor.ToolbarSet="Basic";
//默认是default
oFCKeditor.ToolbarSet="Default";
oFCKeditor.Create() ;
</script>
</body>

(2) through textarea, Xiang see method2.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<script type="text/javascript" src="fckeditor/fckeditor.js"></script>
<script type="text/javascript">
window.onload=function(){
var oFCKeditor = new FCKeditor('MyTextarea') ;
oFCKeditor.BasePath = "fckeditor/";
//oFCKeditor.BasePath   = "/FCKEditTest/fckeditor/";
oFCKeditor.ReplaceTextarea();
}
</script>
<body>
方法二:通过Textarea来实现的实现编辑器导入<br>
<textarea rows="4" cols="60" name="MyTextarea">this is a value</textarea>
</body>

Related Article

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.