FCKeditor应用笔记

1.  下载

官网:www.fckeditor.net

Zip包:FCKeditor_2.6.4.zipfckeditor-java-2.4.1-bin.zipfckeditor-java-2.4.1-src.zip

2.  安装使用

l         FCKeditor_2.6.4.zip的解压文件放入projectwebroot/

l         Index.jsp<head></head>中写入<script type="text/javascript" src="fckeditor/fckeditor.js"></script>

l         js引用方法(三种)

M1. form表单中直接引用

        <script type="text/javascript">

var oFCKeditor = new FCKeditor('FCKeditor1');

oFCKeditor.BasePath = "/fckeditor/";  //注意修改路径

oFCKeditor.Create();

</script>

              M2. 替换表单中的textarea元素

                     Head中写function()

                     <script type="text/javascript">

window.onload = function()

{

var oFCKeditor = new FCKeditor( 'MyTextarea' ) ;

oFCKeditor.BasePath = "/fckeditor/" ;

oFCKeditor.ReplaceTextarea() ;

}

</script>

 

Body中加入textarea

<textarea id="MyTextarea" name="MyTextarea">This is the initial value.</textarea>

              M3. ajax动态生成

                     var div = document.getElementById("myFCKeditor");

var fck = new FCKeditor("myFCKeditor");

div.innerHTML = fck.CreateHtml();

3.  取值

M1. String FCKcontent = request.getParameter(“FCKeditor1);

4.  Sample code

Style1.

<html>

<head>

<title>FCKeditor - Sample</title>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<meta name="robots" content="noindex, nofollow">

<script type="text/javascript" src="fckeditor/fckeditor.js"></script>

</head>

<body>

<form>

<script type="text/javascript">

var oFCKeditor = new FCKeditor('FCKeditor1');

oFCKeditor.BasePath = "/fckeditor/";

oFCKeditor.Create();

</script>

</form>

</body>

</html>

 

Style2.

<html>

<head>

<title>FCKeditor - Sample</title>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<meta name="robots" content="noindex, nofollow">

<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.ReplaceTextarea() ;

}

</script>

</head>

<body>

<textarea id="MyTextarea" name="MyTextarea">This is <b>the</b> initial value.</textarea>

</body>

</html>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值