Topic: How to tell when a child iframe has "loaded" Pages that link to <a href="" title="Pages that link to Topic: How to tell when a child iframe has &amp;quot;loaded&amp;quot;" rel="nofollow" >Topic: How to tell when a child iframe has &quot;loaded&quot;\

Author Thread
Nervous Wreck (II) Inmate

From: California
Insane since: Jul 2004

IP logged posted posted 07-10-2004 01:18 Edit Quote

Is there some way / script which can be placed in a page which will trigger some code when a contained iframe has finished loading? Basically the equiv of <iframe src="foo" onload="bar"/>

however there's no such thing as an onload for an iframe...

--- RPG Fan ---

Paranoid (IV) Inmate

From: France
Insane since: Jun 2002

IP logged posted posted 07-10-2004 08:58 Edit Quote

whisperstom: You shouldn't attach the events on the iframe itself but on/in its own document, body, ... just like any page. If the location of the iframe is on the same domain as that of the main window, it's possible to attach an onload event on the iframe via JavaScript. Otherwise it's not possible for security reasons. Whatever, for the iframe, the main window IS its parent so you the function called onload in the iframe can do things on its parent. For example, the source code of the page in the iframe could look like :

<script type="text/javascript">

function doSomethingToParentWindow()
{ = "pink"

<body onload="doSomethingToParentWindow()" >...

Like I just said in want 2 change background color of a page from external site when refernced within a frame, you must use the window object and its properties like parent, top, frames, ...

Hope that helps,

Post Reply
Your User Name:
Your Password:
Login Options: Remember Me On This Computer
Your Text:
Options: Show Signature
Enable Slimies
Enable Linkwords

« BackwardsOnwards »

Show Forum Drop Down Menu