Hi all.I have been using a certain javascript code to display a "Please wait..." message on screen but it seems to work in some instances and not in others.Please assist me with javascript code that works in all instances. Below is the code I currently use.
In the head tags I have:
Right after the <body> tag I have:
Before </body> tag I have this:
Please assist with making this work at all times or another solution that works on a single page without redirecting to another.
Thanks!
In the head tags I have:
Code:
<script type="text/javascript">
<!-- Begin
function hideLoading() {
document.getElementById('pageIsLoading').style.display = 'none'; // DOM3 (IE5, NS6) only
}
// End -->
</script>
Code:
<div id="pageIsLoading" style="position: absolute; display: block; padding-left: 50px; padding-right: 12px; width: auto; height: 65px; line-height: 40px; border: 1px solid #CCCCCC; color: #000000; font-weight: bold; font-family: verdana; font-size: 12px; background-color: #ffffff; background-image: url([URL unfurl="true"]http://localhost:8080/images/bannerz.jpg);[/URL] background-position: 100px center; background-repeat: no-repeat;">
<script type="text/javascript">
var window_width;
var window_height;
if( typeof( window.innerWidth ) == 'number' ) {
window_width = window.innerWidth;
window_height = window.innerHeight;
} else if( document.documentElement &&( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
window_width = document.documentElement.clientWidth;
window_height = document.documentElement.clientHeight;
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
window_width = document.body.clientWidth;
window_height = document.body.clientHeight;
}
var left = Math.round((window_width - 240) / 2);
var top = Math.round(((window_height - 130) / 3) + 30);
document.getElementById('pageIsLoading').style.left = left+'px';
document.getElementById('pageIsLoading').style.top = top+'px';
</script><p><p><p><p>
Loading page..Please wait...
</div>
Code:
<script type="text/javascript">
if (window.addEventListener) {
window.addEventListener('load', hideLoading, false);
} else if (window.attachEvent) {
var r = window.attachEvent("onload", hideLoading);
} else {
hideLoading();
}
</script>
Thanks!