IE 7, getElementById, iframe

Discussion in 'Javascript' started by datvong@gmail.com, Aug 30, 2007.

  1. Guest

    On Internet Explorer 7, getElementById does not work if I have an
    iframe in my html.

    <html>
    <script language="Javascript">
    function Init()
    {
    var win = document.getElementById("0");
    alert(win);
    }
    </script>


    <body onLoad="Init();">
    <iframe />
    <div id="0"> Hello World</div>
    </body>
    </html>


    In this case, win is NULL. However, if I move the iframe BELOW the
    div, then it works fine. Weird.
     
    , Aug 30, 2007
    #1
    1. Advertisements

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:
    0
    Views:
    884
  2. mi
    Replies:
    4
    Views:
    18,016
    dorayme
    May 21, 2008
  3. elca
    Replies:
    0
    Views:
    755
  4. Scott
    Replies:
    6
    Views:
    1,376
    [MSFT]
    Apr 14, 2004
  5. Replies:
    0
    Views:
    677
  6. Gustavo
    Replies:
    0
    Views:
    195
    Gustavo
    Aug 25, 2003
  7. Daedalous
    Replies:
    3
    Views:
    1,140
    Daedalous
    Jan 16, 2004
  8. AC
    Replies:
    11
    Views:
    434
Loading...