datvong@gmail.com said the following on 8/30/2007 3:06 PM:
> On Internet Explorer 7, getElementById does not work if I have an
> iframe in my html.
Don't blame IE7 for your own mistakes. FF gives the same results - as it
should.
> <html>
> <script language="Javascript">
[quoted text clipped - 13 lines]
> In this case, win is NULL. However, if I move the iframe BELOW the
> div, then it works fine. Weird.
Try validating your HTML. <iframe /> isn't valid HTML. Change your
iframe to proper markup: <iframe></iframe> and IE7 will give you the
results you expect as will any other browser. It will also allow your
text to show up on the page.
The first indication that there was a problem with your HTML should have
been that the text "Hello World" doesn't show up on the page.
Second, ID attributes are not allowed to start with a number.

Signature
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/