0

I am Using Ckeditor version 4.0.1 latest one in my java project using Spring Framework.In my jsp page i have included the main js file as below

<script type="text/javascript" src="<c:url value="./ckeditor/ckeditor.js"/>" ></script>

and in jsp page using textarea i have created an instance like this.

<textarea cols="100" rows="4" id="detailedwriteup" name="detailedwriteup" >${hotel.detailedwriteup}</textarea></div>

<script type="text/javascript">

   var instance = CKEDITOR.instances['detailedwriteup'];
   if(instance){
       CKEDITOR.remove(instance);
   }


    CKEDITOR.replace( 'detailedwriteup',
        {
         width: 900
        });

</script>

It works fine in FF and Chrome also in IE 9 but the problems is coming on IE8.In IE8 the ckeditor instance is not created.

Any solution i am stuck.

Thanks in Advance.

4

1 回答 1

1

您的示例代码将永远无法工作,因为您在实例检查之后实例化 CKEditor。

不过要回答您的问题->始终使用 instanceReady-event

'

<textarea cols="100" rows="4" id="detailedwriteup" name="detailedwriteup" >${hotel.detailedwriteup}</textarea>

<script type="text/javascript">

   CKEDITOR.on('instanceReady', function (event) {
        instance = event.editor;
        if (instance) {
            instance.destroy();
        }
    });


    CKEDITOR.replace( 'detailedwriteup',
        {
         width: 900
        });

</script>

'

于 2013-02-01T08:34:56.183 回答