Showing Loading Window

[Total: 0    Average: 0/5]

If you have a page that involves a big number of javascripts which takes a long time to load, you may want to comfort your customer by showing a popup window saying the page is still loading. Let me share my solution. (A real time loading indicator, not

Head Code:

<SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT"> 
<!-- Hide script from old browsers 
var lw=null;
function initialFunc() { 
 var _d="<html><head><title>Loading...</title></head><body><table width=100% height=100%><tr><td valign=middle align=center>Loading...</td></tr></table></body></html>";
// popup a loading window showing the page is loading. See the HTML for the "loadwin.htm" code 
    lw = window.open("", "_targetLW", "width=400,height=250");
    lw.document.open();
	lw.document.write(_d);
	lw.document.close();
    lw.focus(); 
}
function closeFunc(){if(lw){lw.close();lw=null;}}
// do your stuff ... 
// Or you add dummy code to loop a counter for millions of times :-)) 
initialFunc();
// End hiding script from old browsers --> 
</SCRIPT> 

Init Code:

closeFunc();

Body Code:

<table border=0 cellspacing=0 cellpadding=0 height=100% width=100%> 
<Tr> 
<Td valign="middle" align="center"> 
<img width=95 height=59 src="/js/pic1.gif" v:shapes="_x0000_s1026"> 
<br> 
Loading. Please wait...
</td> 
</tr> 
</table> 

Times Viewed: 4

Leave a Reply

Your email address will not be published. Required fields are marked *