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

Discussion in 'Javascript' started by -Lost, Jun 6, 2007.

  1. -Lost

    -Lost Guest

    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.

    --
    -Lost
    Remove the extra words to reply by e-mail. Don't e-mail me. I am
    kidding. No I am not.
    -Lost, Jun 6, 2007
    #1
    1. Advertising

  2. -Lost

    Pi Guest

    Re: "Operation aborted" in Internet Explorer 6. Script works up until that point.

    On Jun 5, 8:15 pm, -Lost <> wrote:
    > 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



    > ***
    >
    > 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.
    Pi, Jun 6, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    593
    Mike Placentra II
    Oct 4, 2007
  2. Mika
    Replies:
    190
    Views:
    3,694
  3. Saraswati lakki
    Replies:
    0
    Views:
    1,321
    Saraswati lakki
    Jan 6, 2012
  4. gray_slp
    Replies:
    3
    Views:
    122
    Geoffrey Summerhayes
    Jun 27, 2007
  5. Mika
    Replies:
    94
    Views:
    1,009
Loading...

Share This Page