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. 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:
    0
    Views:
    688
  2. mi
    Replies:
    4
    Views:
    13,657
    dorayme
    May 21, 2008
  3. elca
    Replies:
    0
    Views:
    580
  4. Daedalous
    Replies:
    3
    Views:
    718
    Daedalous
    Jan 16, 2004
  5. AC
    Replies:
    11
    Views:
    220
Loading...

Share This Page