
Originally Posted by
bubazoo
Is there a way to display a little blue box on top of the current page, that says something like "one moment please" while the webpage is loading form the server, then automatically closes when the page is fully loaded?
You could create an element as the document loads via scripting, and remove it once the document has been received. For example, include the following in a script element within the body element (not the head element):
Code:
(function() {
var body = document.body,
global = this,
element, textNode;
if (body && body.insertBefore && body.removeChild && document.createElement
&& document.createTextNode && (element = document.createElement('div'))
&& element.appendChild
&& (textNode = document.createTextNode('Loading. Please wait...'))) {
element.className = 'loading';
element.appendChild(textNode);
body.insertBefore(element, body.firstChild);
}
global.onload = function() {
body.removeChild(element);
global.onload = null;
};
})();
and the following rule in your style sheet:
Code:
.loading {
background: #d00000;
color: #ffffff;
font: 80% sans-serif;
padding: 0.1em 0.2em;
position: absolute;
right: 0.2em;
top: 0.2em;
}

Originally Posted by
tech_support
Ajax.
AJAX is totally irrelevant to the problem.
Mike
Bookmarks