Java script Dude wrote:
"Mark" <Ma*******@gems.gov.bc.ca> wrote in message news:<41******@obsidian.gov.bc.ca>...
Please do not write attribution novels, see
<http://www.netmeister.org/news/learn2quote2.html>.
I am loading source files into several iframes, with each load happening
after some user-generated event (like clicking a button). The loading works
but I need to determine when the source file is FULLY loaded so I can do
some calcs on its scroll height within the frame. If I check the scroll
height right away (after fetching the file), it's wrong (some small number)
but if I wait a couple of seconds I get the right value. I need to do
better than just guessing when the file has been loaded.
The best way is to write an asyncronous thread in the parent window
using setTimeout script for interval control. In the window you are
watching, set a global boolean flag in javascript at the bottom of the
body. You could also set the global boolean (window.bLoaded=true) on
body.onload().
I don't think you got him right. How is he supposed to add a script
to a document that holds the source file (he never said it's a (X)HTML
document) he wants to *display* in the iframe?
So AIUI the issue is not how to determine that a script in the source
file has loaded but to determine that the displayed source file itself
has finished loading within the iframe. Alas the "iframe" element does
not provide for an "onload" attribute, but Window objects do have a
"onload" property. So it could work to refer to the "iframe" element
object as a Window object and set its "onload" property to a reference
to an event listening method.
document.frames["iframe_name"].onload = function() { alert(42); };
HTH
PointedEars