Hello,
I just installed IE8, and I am running into a problem with code that worked in IE7. I do not get the error when I run the application on the server; only during debugging mode. The editor is disabled, which is what I want, even though I get the following error (Microsoft JScript runtime error: 'oEditorShort.EditorDocument.body' is null or not an object).
Best Regards,
I just installed IE8, and I am running into a problem with code that worked in IE7. I do not get the error when I run the application on the server; only during debugging mode. The editor is disabled, which is what I want, even though I get the following error (Microsoft JScript runtime error: 'oEditorShort.EditorDocument.body' is null or not an object).
Best Regards,
function FCKeditor_OnComplete(editorInstance) {
editorInstance.Events.AttachEvent('OnBlur', FCKeditor_OnBlur);
var editorName = "ctl00_ContentPlaceHolder1_TabContainer1_TabPanel2_FCKeditor";
var i = 2;
for (i == 2; i < 6; i++) {
oEditorShort = FCKeditorAPI.GetInstance(editorName + i.toString());
oEditorShort.EditorDocument.body.disabled = true;
oEditorShort.EditorDocument.designMode = 'off';
oEditorShort.EditorWindow.parent.FCK.ToolbarSet.Disable();
} 
Re: Microsoft JScript runtime error: EditorDocument.body is null
You're using the FCKEditor_OnComplete function - which runs each time an instance of the FCKEditor is instantiated - to disable a number of instances of FCKEditor, some of which may not yet be completely instantiated at the time.
I would either (1) only disable the current instance, since each instance will result in a call to the OnComplete function, or (2) add a check before disabling the body to verify that there is in fact a body to disable...
(1) is the proper FCKEditor way, (2) is the proper JavaScript way...
Re: Microsoft JScript runtime error: EditorDocument.body is null
On the second tab, I have 4 editors that are used for displaying the text only so they need to be read-only/disabled and are named FCKeditor2, FCKeditor3, FCKeditor4 and FCKeditor5. So I will have to try out the second option.
By the way, if I disable the body, will I still be able to use the scroll bars?
Re: Microsoft JScript runtime error: EditorDocument.body is null
function FCKeditor_OnComplete(editorInstance) { editorInstance.Events.AttachEvent('OnBlur', FCKeditor_OnBlur); if(editorInstance.Name == "ctl00_ContentPlaceHolder1_TabContainer1_TabPanel2_FCKeditor2" || editorInstance.Name == "ctl00_ContentPlaceHolder1_TabContainer1_TabPanel2_FCKeditor3" || editorInstance.Name == "ctl00_ContentPlaceHolder1_TabContainer1_TabPanel2_FCKeditor4" || editorInstance.Name == "ctl00_ContentPlaceHolder1_TabContainer1_TabPanel2_FCKeditor5" ){ editorInstance.EditorDocument.body.contentEditable = 'false'; editorInstance.EditorDocument.designMode = 'off'; editorInstance.EditorWindow.parent.FCK.ToolbarSet.Disable(); } }Re: Microsoft JScript runtime error: EditorDocument.body is null
It is always good to test for the presence of a JavaScript object before attempting to access one of its functions or attributes unless you know for sure that the object exists:
editorInstance = FCKEditorAPI.GetInstance('myinstance'); if (editorInstance && editorInstance.EditorDocument && editorInstance.EditorDocument.body) { editorInstance.EditorDocument.body.contentEditable = 'false'; } // else the editor isn't really all there...