tinyMce是一款功能强大的基于js的富文本编辑器.

官方主页:http://www.tinymce.com/

现在最新的版本是3.4.7了

这款编辑器的功能几乎可以跟微软的office有的一比,毫不逊色。编辑器里面的各项编辑工具都可以定制,大部分高级功能都是以插件的形式添加进来,开发使用者可以根据需要添加/删除自己的功能。

首先下载tinyMce的开发包(建议下载dev版本,里面有大量的实例,还可以查看源代码)

下载链接: http://www.tinymce.com/download/download.php

然后在需要使用的Web页面添加tinyMce文件

<script type="text/javascript" src="common/tiny_mce/tiny_mce_src.js"></script>

只需要添加一个js文件即可,其他tinyMce需要的css和js它会自己加载。

然后在页面的<body>中放一个<textarea id="myRTE"></textarea>

最后使用tinyMce的init方法,在方法的配置里绑定那个textarea就可以了。

tinyMCE.init({
mode : "exact",
  elements : "myRTE",
plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",

// Theme options
theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft"
});
这样就可以在你的web页面使用完整版的tinyMce编辑你的文本了。