码迷,mamicode.com
首页 > 其他好文 > 详细

fckeditor的简单使用

时间:2017-08-29 23:51:53      阅读:373      评论:0      收藏:0      [点我收藏+]

标签:edit   page   meta   base   class   编辑框   head   color   工具   

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script type="text/javascript" src="res/js/jquery.js"></script>
<script type="text/javascript" src="res/fckeditor/fckeditor.js"></script>
<script type="text/javascript">
$(function(){
    var fck=new FCKeditor("myTextArea");
    fck.BasePath="res/fckeditor/";
    fck.ReplaceTextarea();
})

</script>
</head>
<body>
<textarea rows="" cols="" id="myTextArea"></textarea>
</body>
</html>

以上是最基础的引入,同时可以自定义编辑框的工具栏,在fckconfig.js中复制

FCKConfig.ToolbarSets["Default"] = [
    [‘Source‘,‘DocProps‘,‘-‘,‘Save‘,‘NewPage‘,‘Preview‘,‘-‘,‘Templates‘],
    [‘Cut‘,‘Copy‘,‘Paste‘,‘PasteText‘,‘PasteWord‘,‘-‘,‘Print‘,‘SpellCheck‘],
    [‘Undo‘,‘Redo‘,‘-‘,‘Find‘,‘Replace‘,‘-‘,‘SelectAll‘,‘RemoveFormat‘],
    [‘Form‘,‘Checkbox‘,‘Radio‘,‘TextField‘,‘Textarea‘,‘Select‘,‘Button‘,‘ImageButton‘,‘HiddenField‘],
    ‘/‘,
    [‘Bold‘,‘Italic‘,‘Underline‘,‘StrikeThrough‘,‘-‘,‘Subscript‘,‘Superscript‘],
    [‘OrderedList‘,‘UnorderedList‘,‘-‘,‘Outdent‘,‘Indent‘,‘Blockquote‘,‘CreateDiv‘],
    [‘JustifyLeft‘,‘JustifyCenter‘,‘JustifyRight‘,‘JustifyFull‘],
    [‘Link‘,‘Unlink‘,‘Anchor‘],
    [‘Image‘,‘Flash‘,‘Table‘,‘Rule‘,‘Smiley‘,‘SpecialChar‘,‘PageBreak‘],
    ‘/‘,
    [‘Style‘,‘FontFormat‘,‘FontName‘,‘FontSize‘],
    [‘TextColor‘,‘BGColor‘],
    [‘FitWindow‘,‘ShowBlocks‘,‘-‘,‘About‘]        // No comma for the last row.
] ;

更改为

FCKConfig.ToolbarSets["myToolBar"] = [
                                    [‘Source‘,‘DocProps‘,‘-‘,‘Save‘,‘NewPage‘,‘Preview‘,‘-‘,‘Templates‘],
                                    [‘Cut‘,‘Copy‘,‘Paste‘,‘PasteText‘,‘PasteWord‘,‘-‘,‘Print‘,‘SpellCheck‘],
                                    [‘Undo‘,‘Redo‘,‘-‘,‘Find‘,‘Replace‘,‘-‘,‘SelectAll‘,‘RemoveFormat‘],
                                    [‘Form‘,‘Checkbox‘,‘Radio‘,‘TextField‘,‘Textarea‘,‘Select‘,‘Button‘,‘ImageButton‘,‘HiddenField‘]
                                    ] ;

之后在jsp中添加

$(function(){
    var fck=new FCKeditor("myTextArea");
    fck.BasePath="res/fckeditor/";
    fck.ToolbarSet="myToolBar";//自定义工具栏
    fck.ReplaceTextarea();
})

 

fckeditor的简单使用

标签:edit   page   meta   base   class   编辑框   head   color   工具   

原文地址:http://www.cnblogs.com/lm970585581/p/7450763.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!