Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

<body>'s onload event not triggered when encapsulating frame is set to display: none

0 views
Skip to first unread message

Kamil Kukura

unread,
Oct 2, 2002, 11:48:11 AM10/2/02
to
Hi,

I have a page which contains inner frame that is not displayed by
default:

<iframe id="infram" src="innerpage.html" style="display: none">


In above mentioned innerpage.html there's defined onload event as:

<body onload="javascript:parent.iframeReady();">


This works nice in Mozilla 1.1 but not so in version 1.0, not in
Netscape 7.0. It seems that body's onload event is *not* triggered
when inner frame is set not to display. Anybody knows some workaround
for this?

--
Kamil

Martin Honnen

unread,
Oct 3, 2002, 1:03:53 PM10/3/02
to

No, the frame src page is not loaded with display: none (in Netscape 7)
so no event can be fired. You have to make the iframe element visible to
have the document loaded as the following shows

<input type="button" value="show iframe"
onclick="document.getElementById('anIframe').style.display = '';"
/>
<iframe src="javascript: '<html><body
onload=\'alert(event.type);\'>Kibology<\/body><\/html>'"
id="anIframe"
style="display: none;"
></iframe>


That problem has been recently fixed that is why you experience
different results with Netscape 6/7 and a recent Mozilla build.

The only workaround for Netscape 6/7 is not to use display: none if you
want to load the iframe but to use
<iframe style="width: 0; height: 0; visibility: hidden;"

--

Martin Honnen
http://javascript.faqts.com/
http://home.t-online.de/home/martin.honnen/jsgoddies.html

0 new messages