E
Elias
Here's a genuinely unfamiliar sensation: something that works exactly
as expected in Internet Explorer, doesn't work in Firefox at all.
Consider the following code, placed in the onload attribute of the
body element;
document.getElementById('theIframe').addEventListener('load',function
(e)
{
alert(e.toSource());
},false)
document.getElementById('theIframe').src = 'test2.html';
....and an iframe in the body:
<iframe id="theIframe" name="theIframe"></iframe>
While IE (with the required modifications, such as calling attachEvent
and skipping toSource) returns a perfectly normal event object
complete with srcElement (containing the iframe) - Firefox returns an
object that is completely devoid of properties!
This appears to hold true not only for the load event, but at least
click and mouseover too.
At first I was sceptical towards attaching onload to an iframe, but W3
Schools did specify this event valid for the iframe element. Haven't
been able to find any information on the subject at w3.org though.
Anyway, I have found a way around having to use the event object, but
I'm still wondering - has anyone else noticed this, and is there any
way to do this in FF?
as expected in Internet Explorer, doesn't work in Firefox at all.
Consider the following code, placed in the onload attribute of the
body element;
document.getElementById('theIframe').addEventListener('load',function
(e)
{
alert(e.toSource());
},false)
document.getElementById('theIframe').src = 'test2.html';
....and an iframe in the body:
<iframe id="theIframe" name="theIframe"></iframe>
While IE (with the required modifications, such as calling attachEvent
and skipping toSource) returns a perfectly normal event object
complete with srcElement (containing the iframe) - Firefox returns an
object that is completely devoid of properties!
This appears to hold true not only for the load event, but at least
click and mouseover too.
At first I was sceptical towards attaching onload to an iframe, but W3
Schools did specify this event valid for the iframe element. Haven't
been able to find any information on the subject at w3.org though.
Anyway, I have found a way around having to use the event object, but
I'm still wondering - has anyone else noticed this, and is there any
way to do this in FF?