Link to home
Start Free TrialLog in
Avatar of maish
maish

asked on

"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?
ASKER CERTIFIED SOLUTION
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of maish
maish

ASKER

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?
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>
oh yes, and if you have images, then preload them in Javascript too.


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


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
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
Avatar of maish

ASKER

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
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 ;-)


Only works in IE and not in NS
What only works in IE?

Michel
The code works only in IE. did you check it in NS?