首页 > 其他 > 详细

ckeditor的使用与验证

时间:2014-08-19 16:26:14      阅读:214      评论:0      收藏:0      [点我收藏+]

 1、使id=id的textArea变为富文本编辑框

function inittextarea(id)
 {
  CKEDITOR.replace(id,{
         width:‘600px‘,
         height:‘300px‘,
         toolbar : [[‘Source‘,‘Save‘,‘NewPage‘,‘Preview‘,‘Templates‘,‘Cut‘,‘Copy‘,‘Paste‘,‘PasteText‘,‘PasteFromWord‘, ‘SpellChecker‘,‘Scayt‘,‘Undo‘,‘Redo‘,‘Find‘,‘Replace‘,‘SelectAll‘,‘RemoveFormat‘,‘Form‘, ‘Checkbox‘, ‘Radio‘],[‘TextField‘,‘Textarea‘,‘Select‘, ‘Button‘, ‘Bold‘,‘Italic‘,‘Underline‘,‘Strike‘,‘Subscript‘,‘Superscript‘,‘NumberedList‘,‘BulletedList‘,‘Outdent‘,‘Indent‘,‘Blockquote‘,‘JustifyLeft‘,‘JustifyCenter‘,‘JustifyRight‘,‘JustifyBlock‘,‘Link‘,‘Unlink‘],[‘Anchor‘,‘Image‘,‘Flash‘,‘Table‘,‘HorizontalRule‘,‘Smiley‘,‘SpecialChar‘,‘PageBreak‘,‘Styles‘,‘Format‘],[‘Font‘,‘FontSize‘,‘TextColor‘,‘BGColor‘]]
     });
 }

 

2、ckeditor验证:

  

var editor=CKEDITOR.replace( ‘editor1‘ )

或者

var oEditor2=CKEDITOR.instances[id];

 

然后使用如下语句就可以取得编辑器内的值。

editor.document.getBody().getText(); //取得纯文本

editor.document.getBody().getHtml(); //取得html文本

 

ckeditor的使用与验证,布布扣,bubuko.com

ckeditor的使用与验证

原文:http://www.cnblogs.com/qiyongliang/p/3922137.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!