Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: "Please Wait - the Graph is being Created" - progress indicator related


Message #1 by "Mitchell Schaff" <mschaff@h...> on Tue, 19 Feb 2002 21:37:45
Hi Mitchell,

I don't know how you could do this in Netscape, but IE5+ has an event 
called onreadystatechange and a property called readyState, which describe 
the different stages when an element is loading.
The complete list of readyStates are (according to MSDN):

uninitialized Object is not initialized with data. 
loading       Object is loading its data. 
loaded        Object has finished loading its data. 
interactive   User can interact with the object even though it is not
              fully loaded. 
complete      Object has finished loading completely

Using these, you can check when the image has finished loading. For 
example:

 <img src="pic.gif" onreadystatechange="checkState()" id="graph">

 function checkState()
 {
   if(graph.readyState == "complete")
     // show the graph
 }

Just an idea, but you could also change the "loading" images according to 
what the readyState is, using

 switch(graph.readyState)
 {
   case "loading":
     loadingPic.src = "loading.gif"; break;
   case "interactive":
     loadingPic.src = "interact.gif"; break;
 }

It might add a little bit more class to your page.

Regards

Philip
-------------------------
dhtml_phil@p...

  Return to Index