Solved

"please wait, page loading!"??

Posted on 1998-07-12
12
566 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
  • 6
  • 2
  • 2
  • +1
12 Comments
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 50 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 28

Expert Comment

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


0
 
LVL 75

Expert Comment

by:Michel Plungjan
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 75

Expert Comment

by:Michel Plungjan
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Only works in IE and not in NS
0
 
LVL 75

Expert Comment

by:Michel Plungjan
Comment Utility
What only works in IE?

Michel
0
 

Expert Comment

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

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now