explorer crash after switching to designMode

T

Thomas

Hy dudes,

I have a strange problem. I dynamically create an IFrame with
JavaScript and then fill in some content. Afterwards I want to switch
to designMode. There the trouble starts. In Mozilla it works perfectly
(even it doesn't stop loading the page, but this doesn't matter), but
the whole IE crashes and shuts down itself without reason. Can you
help? Has someone had the same problem?
I already switched the order for filling the iframe
in IE -> first switch to designMode & then fill
in Mozilla -> first fill designMode & then switch

My code looks something like this (abbreviated):

function transformIFrame(content,element) {
iFrame = document.createElement("iframe");
iFrame.setAttribute("id","editArea");
iFrame.setAttribute("frameborder","0");
iFrame.setAttribute("marginwidth","0px");
iFrame.setAttribute("marginheight","0px");
iFrame.style.border = "0px";
iFrame.style.padding ="0px";

editAreaHeight = element.offsetHeight;
editAreaWidth = element.offsetWidth;

if(moz) {
element.parentNode.replaceChild(iFrame,element);
} else {
element.replaceNode(iFrame);
}

iFrame = document.getElementById("editArea");
iFrame.height = editAreaHeight;
iFrame.width = editAreaWidth;

editArea = iFrame.contentWindow.document;

styleCSS = "<style>BODY { font-size: 9pt; }</style>";

if(!moz) {
editArea.write("<html><head><title></title>" + styleCSS +
"</head><body>" + content + "</body></html>");
editArea.designMode = "On";
} else {
editArea.write("<html><head><title></title>" + styleCSS +
"</head><body>" + content + "</body></html>");
editArea.designMode = "On";
}
iFrame.contentWindow.focus();
}

Thx for your help
Bye, Thomas

--

"It's a Texan thing - y'all wouldn't understand!" - read in San
Antonio,
July 2003

------------------------------------------------------------------------
 
M

Martin Honnen

Thomas wrote:

I have a strange problem. I dynamically create an IFrame with
JavaScript and then fill in some content. Afterwards I want to switch
to designMode. There the trouble starts. In Mozilla it works perfectly
(even it doesn't stop loading the page, but this doesn't matter), but
the whole IE crashes and shuts down itself without reason. Can you
help? Has someone had the same problem?
I already switched the order for filling the iframe
in IE -> first switch to designMode & then fill
in Mozilla -> first fill designMode & then switch

My code looks something like this (abbreviated):

function transformIFrame(content,element) {
iFrame = document.createElement("iframe");
iFrame.setAttribute("id","editArea");
iFrame.setAttribute("frameborder","0");
iFrame.setAttribute("marginwidth","0px");
iFrame.setAttribute("marginheight","0px");
iFrame.style.border = "0px";
iFrame.style.padding ="0px";

editAreaHeight = element.offsetHeight;
editAreaWidth = element.offsetWidth;

if(moz) {
element.parentNode.replaceChild(iFrame,element);
} else {
element.replaceNode(iFrame);
}

iFrame = document.getElementById("editArea");
iFrame.height = editAreaHeight;
iFrame.width = editAreaWidth;

editArea = iFrame.contentWindow.document;

styleCSS = "<style>BODY { font-size: 9pt; }</style>";

if(!moz) {
editArea.write("<html><head><title></title>" + styleCSS +
"</head><body>" + content + "</body></html>");
Put
editArea.close();
here.

editArea.designMode = "On";
} else {
editArea.write("<html><head><title></title>" + styleCSS +
"</head><body>" + content + "</body></html>");

Try
editArea.close();
here after the write and before you set designMode. Just a guess, test
yourself.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top