beetle
07-14-2003, 06:43 PM
I'm having problems getting an IFRAME into designMode in Gecko. It works fine if the element is hard-coded into the HTML, but if I create it via DOM scripting, I get the following error
Error: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMNSHTMLDocument.designMode]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: file:///C:/work/peterbailey.net/test/rte/new/js/GildedRTE.js :: enableDesignMode :: line 33" data: no]
I've tried both document.createElement and document.createElementNS to creame the IFRAME, both cause the error. Here's how I'm attempting to turn designMode on
function enableDesignMode( id )
{
var iframe = document.getElementById( id );
if ( iframe.contentDocument )
{
iframe.contentDocument.designMode = "on"; // This is line 33 that the error mentions
}
else
{
iframe.document.designMode = "On";
}
}
Like I said, this function works on hard-coded IFRAME elements.
Any clues?
Error: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMNSHTMLDocument.designMode]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: file:///C:/work/peterbailey.net/test/rte/new/js/GildedRTE.js :: enableDesignMode :: line 33" data: no]
I've tried both document.createElement and document.createElementNS to creame the IFRAME, both cause the error. Here's how I'm attempting to turn designMode on
function enableDesignMode( id )
{
var iframe = document.getElementById( id );
if ( iframe.contentDocument )
{
iframe.contentDocument.designMode = "on"; // This is line 33 that the error mentions
}
else
{
iframe.document.designMode = "On";
}
}
Like I said, this function works on hard-coded IFRAME elements.
Any clues?