JavaScript 图像预加载器

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JavaScript 图像预加载器相关的知识,希望对你有一定的参考价值。

<script type="text/javascript">
function preload() {
    if (document.images)
    {
      preload_image_object = new Array();
      image_url = new Array();
      image_url[0] = "images/Homepage/HomepageSquare_2.jpg";
      image_url[1] = "images/Homepage/HomepageSquare_3.jpg";
      image_url[2] = "images/Homepage/HomepageSquare_4.jpg";
      image_url[3] = "images/Homepage/HomepageSquare_5.jpg";
      image_url[4] = "images/Homepage/HomepageSquare_6.jpg";
      image_url[5] = "images/Homepage/HomepageSquare_7.jpg";
      image_url[6] = "images/Homepage/HomepageSquare_8.jpg";
      image_url[7] = "images/Homepage/HomepageSquare_9.jpg";
      image_url[8] = "images/Homepage/HomepageSquare_10.jpg";
 
       for(var i=0, limit = image_url; i<limit; i++)
          {
         preload_image_object[i]=new Image();
            preload_image_object[i].src = image_url[i];
          }
    }
}
</script>


<body onload="javascript:preload();">

以上是关于JavaScript 图像预加载器的主要内容,如果未能解决你的问题,请参考以下文章

javascript 图像预加载器

JavaScript 图像预加载器

JavaScript 图像预加载器

JavaScript 小图像预加载器

JavaScript 图像预加载器

JavaScript 图像预加载器