KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm trying to get the document object of an iframe, but none of the examples I've googled seem to help. My code looks like this: <html> <head> <script> function myFunc(){ alert("I'm getting this far"); var doc=document.getElementById("frame").document; alert("document is undefined: "+doc); } </script> </head> <body> <iframe src="http://www.google.com/ncr" id="frame" width="100%" height="100%" onload="myFync()"></iframe> </body> </html> I have tested that I am able to obtain the iframe object, but .document doesn't work, neither does .contentDocument and I think I've tested some other options too, but all of them return undefined, even examples that are supposed to have worked but they don't work for me. So I already have the iframe object, now all I want is it's document object. I have tested this on Firefox and Chrome to no avail.
Tags (comma-separated)
Save Edits
Cancel