473,320 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 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 2298


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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Lecture Snoddddgrass | last post by:
Hi, When I create a UserControl-derived object, I often expose various public properties. One of the things that I hate about the WinForms designer is that if I decide to embed one of these...
1
by: Tiago Barbutti | last post by:
I have a UserControl that execute methods in Load event, but it hapens in designMode and generate an error and the control disappear from the form. I read that i can use the DesignMode to kwnow...
2
by: Malleier Alfred | last post by:
Hi, what does the Me.DesignMode-Property turn back. I tried to set a MsgBox(Me.DesignMode) in my form's and control's Sub New(), but it allways turns back 'false', even if the form or control is...
29
by: Charles Law | last post by:
Further to my issue about user controls, I have a problem with DesignMode. Here is the project hierarchy: MainApp |_ Project1 |_ SubProject (UserControl) SubProject has a default constructor...
1
by: Paul W | last post by:
I'm having trouble detecting whether my Control is in DesignMode. I'm deriving a class from TreeView; Public Class ExplorerView Inherits TreeView ... End Class
2
by: Simon Rigby | last post by:
Hi folks, I'm trying to switch an iFrame in and out of design mode by way of a script. As you can see from the method it is intended to be cross browser compatible (or FF and IE at least). The...
4
by: Kyjan | last post by:
Greetings! In doing some research, I've learned that some other people have had problems with Me.DesignMode not working correctly when it's used in a user control that is placed on another form....
4
by: timor.super | last post by:
Hi group, I have a strange error. I'm a beginner with dotnet 3.0, when i try to run an wpf application from my windows explorer, the application crash. For example, i've downloaded the demo...
0
by: jeremy | last post by:
I'm building a Windows Forms application using Visual Studio .Net 2005. I have a custom initialization method for a custom UserControl that I run that initializes a trace source and a few web...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.