"please wait, page loading!"??

i have a heavy page, and while it takes its time to load, i want to display alt text like "please wait..." stuff
so how?
maishAsked:
Who is Participating?
 
Michel PlungjanIT ExpertCommented:
in the page you load have

<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
window.open("message.htm","msgwin","width=100,height=100");
</SCRIPT>
</HEAD>
<BODY>
big page
</BODY>
</HTML>

and in message.htm have

<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
setTimeout('self.close()',10000);
</SCRIPT>
</HEAD>
<BODY>
Please wait, page loading...
</BODY>
</HTML>

it will stay open for 10 seconds and then disappear... change the 10000 to modifiy the length of time the please wait is open in miliseconds

Enjoy,
Michel

0
 
maishAuthor Commented:
hi michael,
yes thats one way to do it, but i dont want to open another window
cant i do it in the same window, like 'the introduction to dom' page at the www.projectcool.com website?
0
 
sybeCommented:
The problem is that you can't remove text from a HTML document. So you'll haved to display the text some other way, an image, a form field...something you can change.

Display "please wait" in one of the ways mentioned.


make a function WriteContents () {
  document.write(".......write the contents of the page here...")
}

At the end of your page say

<script>
WriteContents()
</script>
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

 
sybeCommented:
oh yes, and if you have images, then preload them in Javascript too.


0
 
Michel PlungjanIT ExpertCommented:
I don't see why you don't wnat another window, it closes itself...

Anyway, here is a DHTML version
The following should work in MSIE4 and NS4 (but not give errors in the other browsers)

<HTML>
<HEAD>
<STYLE TYPE="text/css">
mtext {
    position: absolute;
    visibility: hidden;
}
-->
</STYLE>
<SCRIPT LANGUAGE="JavaScript">
<!-- // hide from non-js browsers
/* Script lifted from irt.org */
 if (document.layers) var doc = 'document.', vis = '.visibility';
 if (document.all)    var doc = 'document.all.', vis = '.style.visibility';
 function show(object) { if (document.layers || document.all) eval(doc + object + vis + ' = "visible"'); }
 function hide(object) { if (document.layers || document.all) eval(doc + object + vis + ' = "hidden"'); }
// unhide -->
</SCRIPT>
</HEAD>
<BODY>

<SCRIPT LANGUAGE="JavaScript">
<!-- // hide
if (document.layers || document.all) { // First we write the please wait in a layer
   document.write('<DIV ID="text1" CLASS="mtext">');
   document.write('<CENTER>');
   document.write('<TABLE><TR><TD BGCOLOR="#99CCCC"><FONT SIZE="+1"><B>Please wait</B></FONT></TD></TR></TABLE>');
   document.write('</CENTER>');
   document.write('</DIV>');

   show('text1') ; // Show the please wait
}
// -->
</SCRIPT>

big page

<SCRIPT LANGUAGE="JavaScript">
<!-- // hide
   if (document.layers || document.all) hide('text1'); // loose the please wait
// -->
</SCRIPT>
</BODY>
</HTML>

Enjoy,

Michel


0
 
Michel PlungjanIT ExpertCommented:
Also a nice way is to use frames:

<FRAMESET ROWS="100%,*" ONLOAD="top.frames[0].location=top.frames[1].location.href">
<FRAME SRC="pleasewait.htm">
<FRAME SRC="bigpage.htm">
</FRAMESET>

that way the complete page is cached (if the cache is on) and the big page is swapped in when it finished loading

Michel
0
 
Michel PlungjanIT ExpertCommented:
Maish: I am a little disappointed that you give a D for not one, not two but three working examples on how to solve your problem...

Michel
0
 
maishAuthor Commented:
hi there michael,
sorry lah, i am new to this stuff...how did u get a D?
how does one  know?
i just clicked on accepted answer!!
so how does one do it?
sorry again
0
 
Michel PlungjanIT ExpertCommented:
Aha, I hoped that was the case...

When you have the screen with Here are your options:
At the top there is a row of radio buttons marked
A() excellent B() very good C() good D() acceptable

The points you decide that the question is worth will be multiplied by 4,3,2,1 depending on this grade (the points you give remain the same)

Since this is my first D and all the C's I get is from autograding (when people do not return to reject or accept an answer) I was curious to know why...

Michel

PS: If you REALLY want to change your grade, Customer support can probably help (it is onthe home page) hint, hint ;-)


0
 
kouroshmCommented:
Only works in IE and not in NS
0
 
Michel PlungjanIT ExpertCommented:
What only works in IE?

Michel
0
 
kouroshmCommented:
The code works only in IE. did you check it in NS?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.