zoukankan      html  css  js  c++  java
  • ckeditor的使用与验证

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

    function inittextarea(id)
     {
      CKEDITOR.replace(id,{
             '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文本

  • 相关阅读:
    07.15 first与first-child的区别
    7.15 css与js 选择奇偶子元素的区别
    7.15过有意思的生活
    7.14养成健身习惯
    8080端口被占用
    Vue自定义指令和认识钩子函数
    按键修饰符
    Vue 的过滤器
    列表渲染
    在Vue中使用.class样式
  • 原文地址:https://www.cnblogs.com/qiyongliang/p/3922137.html
Copyright © 2011-2022 走看看