Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/369.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript CKEDITOR get实例不工作_Javascript_Jquery_Asp.net_Ckeditor - Fatal编程技术网

Javascript CKEDITOR get实例不工作

Javascript CKEDITOR get实例不工作,javascript,jquery,asp.net,ckeditor,Javascript,Jquery,Asp.net,Ckeditor,我有一个ckeditor对象,我想在当前位置插入文本。所以我尝试获取ckeditor对象,但页面返回错误。我的ckeditor版本是3.6.4 ASPX: 我试过这个: CKEDITOR.instances.txtMessageBody.insertText'some text here' 错误: 未定义CKEDITOR 我最近尝试使用CKEditor,但放弃了,因为它似乎需要很长时间才能进入页面,而且它一直在html中添加回车符。为了摆脱这些,我不得不写下: var editor; funct

我有一个ckeditor对象,我想在当前位置插入文本。所以我尝试获取ckeditor对象,但页面返回错误。我的ckeditor版本是3.6.4

ASPX:

我试过这个:

CKEDITOR.instances.txtMessageBody.insertText'some text here'

错误:


未定义CKEDITOR

我最近尝试使用CKEditor,但放弃了,因为它似乎需要很长时间才能进入页面,而且它一直在html中添加回车符。为了摆脱这些,我不得不写下:

var editor;
function changeEnter()
{
if (editor)
    editor.destroy(true);

editor = CKEDITOR.replace('CKEditor1',
{
on:
{
instanceReady: function (ev)
{
//output paragraphs as <p>Text</p>
this.dataProcessor.write.setRules('p',
{
indent: false,
breakBeforeOpen: true
});
}
}
});
window.onload = changeEnter;
我从他们的一个样本页面中获取了所有这些。我真的不知道它是做什么的,但它是有效的。在将其放到页面上之前,我一直收到CKEditor未定义的消息


抱歉,不必费心缩进代码。为什么在这个网站上发布代码这么难。它将自己打造成卓越的软件论坛——然而你编写代码的方式却糟糕透顶。为什么没有像其他网站那样的[code]标记?

该错误意味着您的CKEditor尚未加载,或者完全无法加载。在第一种情况下,确保执行顺序正确,在第二种情况下检查资源是否已加载。我已经在第页使用了编辑器。但我无法在javascript上访问它。可能是
var editor;
function changeEnter()
{
if (editor)
    editor.destroy(true);

editor = CKEDITOR.replace('CKEditor1',
{
on:
{
instanceReady: function (ev)
{
//output paragraphs as <p>Text</p>
this.dataProcessor.write.setRules('p',
{
indent: false,
breakBeforeOpen: true
});
}
}
});
window.onload = changeEnter;