Message on loading
<p>This is a crossbrowser window.onload script, I want to add a <strong>message, when the page loads</strong> (<code>&lt;div id="message"&gt;Loading, please wait&lt;/div&gt;</code>), and <strong>it must disappear when page finished loading</strong>. How can I do that? Please help.</p>

<pre><code>function init() {
    if (arguments.callee.done) return;
    arguments.callee.done = true;
};

if (document.addEventListener) {
    document.addEventListener("DOMContentLoaded", init, false);
}

/*@cc_on @*/
/*@if (@_win32)
document.write("&lt;script id=\"__ie_onload\" defer=\"defer\" src=\"javascript:void(0)\"&gt;&lt;\/script&gt;");
var script = document.getElementById("__ie_onload");
script.onreadystatechange = function() {
    if (this.readyState == "complete") {
    init();
    }
};
/*@end @*/

if (/WebKit/i.test(navigator.userAgent)) {
    var _timer = setInterval(function() {
    if (/loaded|complete/.test(document.readyState)) {
        clearInterval(_timer);
        init();
    }
    }, 10);
}

window.onload = init;
</code></pre>
