Loading message while a page is loading?

Loading message while a page is loading?

Hello my friends !
Is it possible to "Only" display a loading message and hide all page's elements and graphics until the page is fully loaded. then loading message disappear and the content fades in!?

I can't think of it's logic more than this one logic which doesn't work properly !

  1. <script type="text/javascript>"
  2. $(function(){
  3. // this is a tab for example!
  4. $(".HomeTab").click(function(){
  5. $("#LoadingMsg").show(1000);
  6. $("body").load('home.php', function(){
  7. $("#LoadingMsg").hide(1000);
  8. });
  9. });
  10. });
  11. </script>


This doesn't do the job! for me!
Any suggestions or help is greatly appreciated!