INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Please wait...using javascript in jsp page

Please wait...using javascript in jsp page

(OP)
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:

CODE

<script type="text/javascript">
 
<!-- Begin
function hideLoading() {
    document.getElementById('pageIsLoading').style.display = 'none'; // DOM3 (IE5, NS6) only
}
//  End -->
</script>
Right after the <body> tag I have:

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(http://localhost:8080/images/bannerz.jpg); 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>
Before </body> tag I have this:

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>
Please assist with making this work at all times or another solution that works on a single page without redirecting to another.
Thanks!  

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close