472,098 Members | 2,572 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,098 software developers and data experts.

explorer crash after switching to designMode

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

------------------------------------------------------------------------
Jul 20 '05 #1
1 2197


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.
editArea.designMode = "On";
}
iFrame.contentWindow.focus();


--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Lecture Snoddddgrass | last post: by
1 post views Thread by Tiago Barbutti | last post: by
2 posts views Thread by Malleier Alfred | last post: by
29 posts views Thread by Charles Law | last post: by
1 post views Thread by Paul W | last post: by
2 posts views Thread by Simon Rigby | last post: by
reply views Thread by jeremy | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.