Jeff Thies <cy*******@sprintmail.com> writes:
I have an iframe (IE5):
<iframe name="frame1" id="frame1" src="some_source">test</iframe>
that test appears outside the iframe, the src contents are in the iframe
though
I'd like to read the iframe.
var frame1=document.getElementById('frame1').innerHTML ;
What I get is "test", not what the contents of the iframe actually is.
What have I done wrong?
You want to access the content page in the frame. That is a completely
different page, so its HTML is not part of the iframe element on this
page.
What you can do is either:
var frame1=document.getElementById('frame1');
var iframeDocument = frame1.contentWindow ? frame1.contentWindow.document
: frame1.contentDocument;
var root = iframeDocument.documentElement || iframeDocument.body;
var HTML = root.innerHTML;
or
var frame1Document = frames['frame1'].document;
var root = iframeDocument.documentElement || iframeDocument.body;
var HTML = root.innerHTML;
/L
--
Lasse Reichstein Nielsen -
lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'