troubleshooting Question

innerHTML of an IFRAME issues

Avatar of clam61
clam61 asked on
JavaScript
7 Comments2 Solutions1358 ViewsLast Modified:
gosh, why can't everyone use IE?

i have an iframe:

<iframe id="myFrame" src="whatever.htm"></iframe>

in the javascript if i run some test code and


code:--------------------------------------------------------------------------------

alert (myFrame.document.body.innerHTML);
---------------------------------------------------------------------------------------

will successfully give me the innerHTML of the iframe, i.e. the innerHTML of the src, but if i do this

code:--------------------------------------------------------------------------------

frameObj = document.getElementById("myFrame");
alert(frameObj.document.body.innerHTML);
---------------------------------------------------------------------------------------

it simply gives me the innerHTML of the body of the current document!

and if i try it in netscape, the latter code does nothing. it seems like innerHTML for netscape is not supported?
ASKER CERTIFIED SOLUTION
cubrovic

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros