View Full Version : Onload in an iframe

Mr J
10-13-2005, 04:47 PM
Are there any cross browser problems regarding the use of the onload event in an iframes tag?


10-13-2005, 05:08 PM
document.getElementById('iframe_id').contentWindow.window.onload=function(){...do something...}

The piece of code is crossbrowser AFAIK, at least for modern browsers.

...maybe the fact that it is safer to use the full root window in code should be a problem when dealing with frames/iframes...

Mr J
10-13-2005, 06:37 PM
Thanks Kor, just wanted to make sure that onload in an iframe tag was still a viable option.

10-14-2005, 08:41 AM
I see that W3C recomadation for HTML 4.0 don't specify the onload amongst the iframe's attributes, but I guess that as, in fact, inner frames inherit all the frame's (and frameset's) attributes/methods, thus they accept onload as handler/event as well.

Mr J
10-14-2005, 02:05 PM

I see that W3C recomendation for HTML 4.0 don't specify the onload amongst the iframe's attributes

I had a quick look myself but did not come across anything positive so I thought I'd play it safe and simply ask the experts, just in case :D

Once again thanks :thumbsup:

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum