Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determine whether htm is loaded ?

Status
Not open for further replies.

nomy

Programmer
Jul 20, 1999
23
PK
Hi
I am executing a javascript code in framed document.
Script is being executed in a frame which loads an htm file in another frame and gets a property of document that is loaded. Problem is that the document takes time to load completely and when the property is tried to get, it gives an error. What can I do to check whether the document has been loaded fully or not.
 
You just need to set onload event handler. For example:
Code:
parent.frames['tempFrm'].onload=myfunction;
parent.frames['tempFrm'].location.href='my.htm';

Michael Dubner
Brainbench MVP/HTML+JavaScript

 
You could access parent.frame2.document.readyState

The possible values are uninitialized, loading, loaded, interactive, and complete.

So, if parent.frame2.document.readyState=="complete", then do your code.

Or you could use parent.frame2.document.onload, as Michael suggested, which executes the specified code whenever the document has finished loading.
Sincerely,

Tom Anderson
CEO, Order amid Chaos, Inc.
 

Hey tanderso, where did you find that property? That's actually quite cool, say are there many odd props like this that people don't know about, how do you find them?

Let us know!
-Ben "Alright whatever man, I'll hook up the hair, but I aint touchin the ring...Cause I'm still a pla--yer"
 
Cool bro.

-Ben. "Alright whatever man, I'll hook up the hair, but I aint touchin the ring...Cause I'm still a pla--yer"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top