javascript: waiting for an iframe page to load before writing to it (but not from the page that's tr
Posted
by Bill Dawes
on Stack Overflow
See other posts from Stack Overflow
or by Bill Dawes
Published on 2009-09-23T08:31:59Z
Indexed on
2010/05/28
21:02 UTC
Read the original article
Hit count: 300
JavaScript
|iframes
Apologies if this has been answered elsewhere, but I haven't been able to find it referenced. (Probably because nobody else would want to do such a daft thing, I admit).
So, I have a page with three iframes in it. An event on one triggers a javascript function which loads new pages into the other two iframes; ['topright'] and ['bottomright'].
However, javascript in the page that is being loaded into iframe 'topright' then needs to send information to elements in the 'bottomright' iframe.
window.frames['bottomright'].document.subform.ID_client = client; etc
But this will only work if the page has fully loaded into the bottomright frame. So what would be the most efficient way for that code in the 'topright' iframe to check and ensure that that form element in the bottomright frame is actually available to write to, before it does write to it? Bearing in mind that the page load has NOT been triggered from the topright frame, so I can't simply use an onLoad function.
(I know this probably sounds like a hideously tortuous route for getting data from one page to another, but that's another story. The client is always right, etc...:-))
© Stack Overflow or respective owner