gpt4 book ai didi

javascript - TypeError : CKEDITOR. 实例未定义 - 对象实例测试给出错误

转载 作者:行者123 更新时间:2023-11-28 02:18:29 25 4
gpt4 key购买 nike

情况:在 jQuery 对话框中调用 CKEDITOR(这里有很多挑战)。我的具体问题是,当我测试 CKEDITOR 实例是否存在时,我总是会抛出错误。

测试浏览器:Firefox 21、IE 9、Safari 5.1.7

错误:错误:TypeError:CKEDITOR.instance 未定义

所有这些测试 CKEDITOR 实例的方法总是会抛出 JavaScript 错误:

if(!CKEDITOR.instance['编辑器']){

if(CKEDITOR.instance['编辑器']){

if(!typeof CKEDITOR.instance['editor'] == "未定义"){

if(!typeof(CKEDITOR.instance['editor']) == "未定义"){

if(typeof CKEDITOR.instance['editor'] != "未定义"){

if(typeof CKEDITOR.instance['editor'] !== "未定义"){

if(typeof CKEDITOR.instance['editor'] ===“未定义”){

当然,在发表这篇文章之前我浏览了 StackOverflow。我已经尝试了 StackOverflow 上建议的“typeof”和“undefined”的每种组合。

如果在测试实例是否存在时出现错误,如何测试对象实例是否存在?一个难题!

最佳答案

:

CKEDITOR.instance

但是:

CKEDITOR.instances

而且它始终存在 - 无需测试它。

关于javascript - TypeError : CKEDITOR. 实例未定义 - 对象实例测试给出错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16039319/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com