Welcome to WebmasterWorld Guest from 54.197.94.141

Forum Moderators: open

Message Too Old, No Replies

How to get contentWindow of IFrameElement in opera 7?

   
6:49 am on Jun 4, 2003 (gmt 0)

10+ Year Member



how?
thx
8:58 am on Jun 4, 2003 (gmt 0)

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



contentWindow is IE only, non-standard code.

Just assign your iframe an id and access it that way.

10:48 am on Jun 4, 2003 (gmt 0)

10+ Year Member



i just wrote "contentWindow" to express what i need

in IE:
<iframe id="a"></iframe>
<script>
var a = document.getElementById('a');
alert(a.contentWindow.self);
</script>
i get [object]

and u think i can get a.self instead of a.contentWindow.self in opera 7?

and how do u document.write into a iframe?

5:29 pm on Jun 6, 2003 (gmt 0)

10+ Year Member



ok, it's a display:none problem

opera7 do not present window object of iframe if it's hidden

<iframe name=... id=...>required text here</iframe>

<script>
var ifm = document.getElementById("iframeElementId");
alert(ifm.contentDocument); // null
if (self.iframeName == ifm) { // true for opera7 when iframe display:none
ifm.style.display = "block";
ifm.style.display = "none";
alert(ifm.contentDocument); // still null

setTimeout("alert(ifm.contentDocument);", 1000) // object [HTMLDocumentElement]
alert(self.iframeName == ifm); // false
}

</script>