aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes JavaScript: Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "JavaScript: "Wait while loading" message" Watch "JavaScript: "Wait while loading" message" New topic
Author

JavaScript: "Wait while loading" message

marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

I'm trying to display a "Please wait while page loads" message. So I added a div with a loading message immediately underneath the opening body tag (in which init() is called)...

As is (without modifying the init function), the div displays as expected at the top of the page.

Next, I added the following to the page's init() function...

(Because I'm a JavaScript novice, I based this on an ancient example.)

These lines seem to be working correctly, because the div is now "hidden" when the page loads. The problem is that the div is not showing before its display is set to "none." Is there something "obvious" I'm missing here?


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
If you place the script right after the div, of course it will not show because as soon as the div is done rendering, the JavaScript code is called and hides it.

You probably should be callig your code on the page load event





What is taking so long to run/render that you want to add this loading message?

Eric
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Eric Pascarello:
...You probably should be callig your code on the page load event...

The code is inside the init() function, which is being called in the body tag with onload. Would this make a difference?

The page is an xml table of contents tree pulling its data from a Lotus Notes database. In some cases this is taking up to 10 seconds to load. (It's a lot of really messy stuff supplied by a vendor.)
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
If the data is being pulled on the server, than the wait message will not matter since the page does not get retured until the server is done procesing.

You would need to put the wait message before you make the request on the previous page OR you should use Ajax.

Eric
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Eric Pascarello:
...You would need to put the wait message before you make the request on the previous page...

That makes sense. I'll look at that. Thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JavaScript: "Wait while loading" message
 
Similar Threads
problem in paging using javascript
progress bar
Please wait message
Show ad for 5 sec then show content
Dispaly "Saving please wait" message when submitting the form