`
guodongbingtuan
  • 浏览: 40682 次
  • 性别: Icon_minigender_2
  • 来自: 山西
社区版块
存档分类
最新评论

FCKeditor应用笔记

    博客分类:
  • java
阅读更多
<script>function StorePage(){d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(keyit=window.open('http://www.365key.com/storeit.aspx?t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t),'keyit','scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes'));keyit.focus();}</script>

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>

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics