js loading page message not working on php file

Posted by eggman20 on Stack Overflow See other posts from Stack Overflow or by eggman20
Published on 2010-12-26T00:46:06Z Indexed on 2010/12/26 0:54 UTC
Read the original article Hit count: 188

Filed under:
|
|

Merry Christmas guys,

I found a code that displays a loading message using a gif. It uses the onLoad="init()" in the body tag. It works fine on an HTML file but it doesn't when the file is in PHP. Do I need to change anything in here or this just won't work in a PHP file? here's the code:

<body onLoad="init()">
   <div id="loading" style="position:absolute; width:100%; text-align:center; top:300px;">
   <img src="loading.gif" border=0></div>

   <script>
     var ld=(document.all);
     var ns4=document.layers;
     var ns6=document.getElementById&&!document.all;
     var ie4=document.all;
     if (ns4)
   ld=document.loading;
     else if (ns6)
   ld=document.getElementById("loading").style;
     else if (ie4)
   ld=document.all.loading.style;

  function init() {
     if(ns4){ld.visibility="hidden";}
     else if (ns6||ie4) ld.display="none";
  }
  </script>

  <!-- Content here -->
  </body>

Thanks in advance!!!

© Stack Overflow or respective owner

Related posts about php

Related posts about JavaScript