By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,307 Members | 2,120 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,307 IT Pros & Developers. It's quick & easy.

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

P: n/a
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[i];
}
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.

--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am
kidding. No I am not.
Jun 6 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Pi
On Jun 5, 8:15 pm, -Lost <maventheextrawo...@techie.comwrote:
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[i];
}
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 </bodytag. Then apply your script to
document.getElementById('xyz'). I think it should work.

Pi
***

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.

--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am
kidding. No I am not.

Jun 6 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.