"Operation aborted" in Internet Explorer 6. Script works up untilthat point.

L

-Lost

This is more of a post to inform, unless of course I am missing
something fundamental, in which case I would appreciate anyone
explaining it.

Based on Mr. Michaux's camelizeStyle function I wrote:

function create_style(style)
{
var p = document.createElement('p');
var t = document.createTextNode('Just something to fill the P.');
p.appendChild(t);
for (var i in style)
{
p.style[camel_style(i)] = style;
}
getTags('body')[0].appendChild(p);
}

getTags is simply a wrapper for getElementsByTagName.

Now... I happened to notice that in Internet Explorer 6 (Windows XP
SP2), if I called create_style({ 'background-color': '#00f' }) within
the document BODY, Internet Explorer firstly shows me my newly created
P, styles and all, and THEN issues a message box (like an alert) saying:

***
Internet Explorer cannot open the Internet site
file://test_create_style.htm.

Operation aborted

[ OK ]
***

Why does it abort? I am assuming because it was not in a DOM-ready state.

Why does it show me the newly created P, styles and all? I am assuming
because Internet Explorer mostly does what it wants to.

Anyway, the same function performs wonderfully in the onload event.
Declared as window.onload or as an inline event to the BODY.
 
P

Pi

This is more of a post to inform, unless of course I am missing
something fundamental, in which case I would appreciate anyone
explaining it.

Based on Mr. Michaux's camelizeStyle function I wrote:

function create_style(style)
{
var p = document.createElement('p');
var t = document.createTextNode('Just something to fill the P.');
p.appendChild(t);
for (var i in style)
{
p.style[camel_style(i)] = style;
}
getTags('body')[0].appendChild(p);

}

getTags is simply a wrapper for getElementsByTagName.

Now... I happened to notice that in Internet Explorer 6 (Windows XP
SP2), if I called create_style({ 'background-color': '#00f' }) within
the document BODY, Internet Explorer firstly shows me my newly created
P, styles and all, and THEN issues a message box (like an alert) saying:

***
Internet Explorer cannot open the Internet site
file://test_create_style.htm.

Operation aborted

[ OK ]



IE has issues where it crashes in the manner you specified if you try
to modify a DOM element before it's completely loaded. Happened to me
many times before. My suggestion? Wrap all your content in a div
wrapper, say with id="xyz", and then put your script block outside
that div, but before the </body> tag. Then apply your script to
document.getElementById('xyz'). I think it should work.

Pi
 

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,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top