Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > explorer crash after switching to designMode

Reply
Thread Tools

explorer crash after switching to designMode

 
 
Thomas
Guest
Posts: n/a
 
      01-25-2004
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

------------------------------------------------------------------------
 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      01-25-2004


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/

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Process Switching vs. Fast/CEF Switching? asdf Cisco 7 05-29-2007 05:26 PM
Can one crash a CF card by switching off at the wrong time? Keith Hobbs via PhotoKB.com Digital Photography 10 03-02-2005 03:08 PM
Re: DesignMode for webforms... Natty Gur ASP .Net 1 06-04-2004 01:37 PM
Using DesignMode in ASP.NET Marcel Balcarek ASP .Net 1 11-12-2003 07:55 PM
After the execution of frame.iframe.document.designMode="On" , I lost the access to iframe, it says permission denied bhaskarna@yahoo.com Javascript 0 07-17-2003 05:05 AM



Advertisments