如何在复制CKEditor时删除编辑器

时间:2017-08-14 08:42:38

标签: javascript html css ckeditor

我在网络上使用编辑器,我想用CKEditor的新编辑器替换旧的编辑器

那些是我的js:

    <-- js of old editor -->
    <link rel="stylesheet" type="text/css" href="../../css/test_style.css">
    <script type="text/javascript" src="./se2/js/HuskyEZCreator.js" charset="utf-8"></script>
    <script type="text/javascript" src="./se2/js/smarteditor_etest_util.js" charset="utf-8"></script>

    <!-- js of new editor -->
    <script src="https://cdn.ckeditor.com/4.6.1/standard-all/ckeditor.js"></script>

这是我的HTML:

<table border="0">
    <tr>
        <td width="640" height="650">
        <!-- naver smart editor -->                     
        <!-- <textarea name="ir1" id="ir1" rows="1" cols="10" style="width:580px; height:600px; min-width:400px; min-height:50px; display:none;"></textarea> -->                        

        <div class="container">
        <!-- <h2><label for="editor1">Developer Site Editor</label></h2> -->
        <textarea name="ir1" id="ir1"> </textarea>
        </div>

<script>
        CKEDITOR.replace( 'ir1', {
        // Define the toolbar: http://docs.ckeditor.com/#!/guide/dev_toolbar
        // The standard preset from CDN which we used as a base provides more features than we need.
       // Also by default it comes with a 2-line toolbar. Here we put all buttons in a single row.
        toolbar: [
            { name: 'document', items: [ 'Source' ] },
            { name: 'basicstyles', items: [ 'Bold', 'Italic' ] },
            { name: 'paragraph', items: [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote' ] },
            { name: 'links', items: [ 'Link', 'Unlink' ] },
            { name: 'insert', items: [ 'CodeSnippet', 'Image', 'Mathjax' ] },           { name: 'styles', items: [ 'Format', 'Styles' ] }
            ],

    ...
</script>

    <!-- end of naver smart editor -->

    </td>           
    </tr>
</table>

我的剧本:

<script>
 var qtype = "<%=qtype%>";
 var excount = <%=excount%>;
 var cacount = <%=cacount%>;
 function OnSave()
 {  
  var form = document.writeForm;        
  var s = seu_getEditorValidContent('ir1', "Input question.");
  if (s)    {
    form.contents1.value = s;    
  } else {
     return;
 }  
 if(qtype == "2" || qtype == "3") {
     if ( excount >=3 ) {
      s = seu_getEditorValidContent('ir2', "Please enter example 1.");
        if (s)  {
        form.contents2.value = s;    
        } else {
             return;
        }
        s = seu_getEditorValidContent('ir3', "Please enter example 2.");
        if (s)  {
            form.contents3.value = s;    
        } else {
             return;
        }                       
  } 
  form.contents10.value = seu_getEditorContent('10');  
  form.contents11.value = seu_getEditorContent('11');
  form.contents12.value = seu_getEditorContent('12'); 
}

当我使用id =&#34; ir1&#34;在textarea它仍然显示旧编辑器。如何删除旧编辑器并替换新编辑器(CKEditor)? 我部署并运行脚本

谢谢!

0 个答案:

没有答案