fckeditor加载完毕事件FCKeditor_OnComplete
fckeditor编辑器是iframe形式的,如果判断fckeditor的编辑器区域是否加载完毕。即使放在window.onload中执行fckeditor的编辑器区域的初始化操作,也会出现无法找到fckeditor编辑器body对象。
varr fck = new FCKeditor('fck'); fck.BasePath = '/fckeditor/'; fck.Height = 450; fck.Value = 'fckeditor内容'; fck.Create(); window.onload = function () { console.log(FCKeditorAPI.GetInstance('fck').EditorDocument)//控制台输出undefined,所以再调用body就会出错了 }
可以使用全局fckeditor加载完毕事件,而不是使用window.onload事件
//编辑器加载完毕后会自动调用名字为FCKeditor_OnComplete的函数,并将自身作为参数传递进去,一般在FCKeditor_OnComplete函数初始化编辑器 function FCKeditor_OnComplete(editorInstance) { console.log(FCKeditorAPI.GetInstance('fck').EditorDocument)//Document对象 }
加支付宝好友偷能量挖...
原创文章,转载请注明出处:fckeditor加载完毕事件FCKeditor_OnComplete