The latent loading

For whom a secret, that presently Internet - pages are simply overflown various grafikoj (banners, design of a page, graphic counters) - without it already it is almost impossible to present a beautiful and popular page. Long loading of such pages very much irritates, and as it would be desirable to wait for some time and to see a page in all krase.


I also have decided to write clause{article} about how to write a small script with use of technologies DHTML which would load all to the schedule on a page is latent, and then would show her  in all krase.


Give those at once we shall start to assort, as though to us to write such script.


Let's make a script more simple, we shall break it  into two procedures.


The first procedure should hide a context of a page and deduce{remove} the information to the user, - a pier, wait for some time, the page is loaded. The second procedure should load all to the schedule which uses our page.



The first procedure


As well as it has been written it is procedure earlier hides a context to a page and deduces the message.



<SCRIPT language=javascript> <br>

<! - <br>

  var nn4 = document.layers? true:false;

  var ie4 = document.all? true:false;


    function hideContent ()

    {

     if (document.all)

    {

      document.all.showContent.style.visibility = "hidden";

}

}


      if (ie4)

       {

        var html;

html = ' <div id = "showContent" style = " position: absolute; left:0px;

top:0px; z-index:200; width:1024; height:768; "> '

html + = ' <table width = "1024" height = "768" border = "0"

cellspacing = "10" cellpadding = "10" bgcolor = " * F6F8F9 "> '

html + = ' <tr> '

html + = ' <td align = "left" valign = "top"> '

html + = ' <span class = "bold"> woscripts.com </span> <br> <span class = "smalltext">

There is a loading schedules... Please <b> wait </b> </span> '

html + = ' </td> '

html + = ' </tr> '

html + = ' </table> '

html + = ' </div> '

<br>

        document.write (html);

}

//->

</SCRIPT>


The second procedure


The second procedure podgruzhaet to the schedule which is used on a page. In a created file preloadImages you should register to the schedule (picture) and which should be loaded on pages (logo, banners i.t.d.). You should specify a full way to each graphic file (picture) examples are below resulted. For example: image/logo.gif - from the catalogue image it is loaded a graphic file (picture) logo.gif



<SCRIPT language=JavaScript>

<!--

   var nn4 = document.layers? true:false;

   var ie4 = document.all? true:false;


    function Loadz () {

     if (ie4)

      {

       <b> var preloadImages </b> = new Array ("background.gif",

       "1 .gif ",

       "links/wolinks.gif",

       "logo.gif",

       "banner.gif");


      var i;

      var imageLoaded = new Array ()


      for (i=0; i <preloadImages.length; i ++)

        {

         imageLoaded [i] = new Image ();

         imageLoaded [i] .src = preloadImages [i];

}

}

}


//->

</SCRIPT>


So procedures are written, now we need to introduce this code in html.


Connection procedure


These two procedures should necessarily, is in a file an index (index.htm, Index.html i.t.d.) that is from that file which begins loading your site. We insert in an index a file the procedures written by us up to key BODY, it is the best way to make it right after META-tags. We write down in key BODY calls on our procedures: onload = " loadz (); hideContent () "

And all job.