Welcome to WebmasterWorld Guest from

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



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>
var a = document.getElementById('a');
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>

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



Featured Threads

Hot Threads This Week

Hot Threads This Month