onload does not work in IE7

Discussion in 'Javascript' started by Daniel Loose, Feb 13, 2008.

  1. Daniel Loose

    Daniel Loose Guest

    Hi,

    I am showing a document that contains an element with the id ID in a
    newly created popup. The element ID shall get some certain style then
    (in my case, I want to change display from none to inline, in order to
    show ID; but that's not the point/the problem here) For that purpose,
    I define an onload handler after creating the popup. That is we have:

    MeinFenster = window.open(url, "width=700");
    MeinFenster.focus();
    MeinFenster.onload=function(){
    MeinFenster.document.getElementById('ID').style.display =
    'inline';
    }

    This works fine in FF. *But not in IE7*: Nothing happens there at all,
    as if there would be no onload handler defined. No error message, no
    alert when I replace the style command with a debug alert, nothing.

    What am I doing wrong? How can I get that to work also in IE? Thanx a
    ton! D.

    PS Note, without onload handler it cannot work at all since ID does
    not yet exist directly after opening the popup.

    *************

    Marty - it's perfect! You're just not thinking fourth dimensionally!
    [Emmett "Doc" Brown]

    If you wish to email me, please use newsreply at wuwei minus webservices dot de
     
    Daniel Loose, Feb 13, 2008
    #1
    1. Advertisements

  2. Daniel Loose

    GArlington Guest

    Try to give different id to your element - myID ?
     
    GArlington, Feb 13, 2008
    #2
    1. Advertisements

  3. Daniel Loose

    Daniel Loose Guest

    |
    |Try to give different id to your element - myID ?

    Well actually in real life the id IS something else than ID ( I think
    simply "V"), I only chose ID in the posting for abstraction. (I will
    try another id anyhow, but not optimistic...)

    *************

    Marty - it's perfect! You're just not thinking fourth dimensionally!
    [Emmett "Doc" Brown]

    If you wish to email me, please use newsreply at wuwei minus webservices dot de
     
    Daniel Loose, Feb 13, 2008
    #3
  4. Daniel Loose

    SAM Guest

    Daniel Loose a écrit :
    and doing like that :

    MeinFenster = window.open(url, "width=700");
    MeinFenster.onload=function(){
    MeinFenster.document.getElementById('ID').style.display = 'inline';
    }
    MeinFenster.focus();

    or :

    function popIdInline( {
    MeinFenster.document.getElementById('ID').style.display = 'inline';
    }
    MeinFenster = window.open(url, "width=700");
    MeinFenster.onload= 'openener.popIdInline()';
    MeinFenster.focus();
     
    SAM, Feb 13, 2008
    #4
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.