我已將CKEditor包含在我的網站上。一切正常,即使我得到這個JS錯誤:未捕獲的異常:[CKEDITOR.editor]該實例已存在
未捕獲的異常:[CKEDITOR.editor]實例「simple_editor」已存在。
下面的代碼包含在一個PHP文件中,我將它包含在我想要的編輯器中。我每個頁面只有一個編輯器實例。
<textarea class='ckeditor' id='simple_editor' name='simple_editor'>".$page_content."</textarea>";
<script type="text/javascript">
CKEDITOR.replace('simple_editor',
{
height: '110px',
toolbar :
[
['Link','Unlink'],
['Styles','Format','Font','FontSize'],
['Bold','Italic','Underline','Strike'],
['TextColor','BGColor'],
['NumberedList','BulletedList','Outdent','Indent']
]
});
</script>
經過一番谷歌搜索後,我看到有人發佈了一些dosnt工作的解決方案。
if (CKEDITOR.instances['simple_editor']) { delete CKEDITOR.instances['simple_editor'] };
if (CKEDITOR.instances['simple_editor']) { CKEDITOR.instances['simple_editor'].destroy(); }
任何人都知道該怎麼辦? :S
對不起,延遲迴復。這固定了它。謝謝! :) – horgen 2010-09-20 07:05:54
最後,一個工作和可以理解的答案。 – zessx 2012-10-12 09:35:36
你節省了我很多時間.... – VKGS 2014-04-28 10:05:13