Solved

"please wait, page loading!"??

Posted on 1998-07-12
12
577 Views
Last Modified: 2012-05-05
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?
0
Comment
Question by:maish
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 2
  • 2
  • +1
12 Comments
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 50 total points
ID: 1266468
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
 

Author Comment

by:maish
ID: 1266469
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
 
LVL 28

Expert Comment

by:sybe
ID: 1266470
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 28

Expert Comment

by:sybe
ID: 1266471
oh yes, and if you have images, then preload them in Javascript too.


0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 1266472
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
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 1266473
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
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 1266474
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
 

Author Comment

by:maish
ID: 1266475
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
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 1266476
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
 

Expert Comment

by:kouroshm
ID: 3651175
Only works in IE and not in NS
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 3724338
What only works in IE?

Michel
0
 

Expert Comment

by:kouroshm
ID: 3727402
The code works only in IE. did you check it in NS?
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question