Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Javascript Image PreLoad (See related posts)

// Javascript Image Preload
   1  
   2  <script type="text/javascript">
   3      <!--
   4  
   5      if (document.images)
   6      {
   7        preload_image_object = new Image();
   8        // set image url
   9        image_url = new Array();
  10        image_url[0] = "http://mydomain.com/image0.gif";
  11        image_url[1] = "http://mydomain.com/image1.gif";
  12        image_url[2] = "http://mydomain.com/image2.gif";
  13        image_url[3] = "http://mydomain.com/image3.gif";
  14  
  15         var i = 0;
  16         for(i=0; i<=3; i++) 
  17           preload_image_object.src = image_url[i];
  18      }
  19  
  20      //-->
  21      </script> 

You need to create an account or log in to post comments to this site.


Click here to browse all 5349 code snippets

Related Posts