图像预加载程序

Posted

tags:

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

  1. <script type="text/javascript">
  2. function preload() {
  3. if (document.images)
  4. {
  5. preload_image_object = new Array();
  6. image_url = new Array();
  7. image_url[0] = "images/Homepage/HomepageSquare_2.jpg";
  8. image_url[1] = "images/Homepage/HomepageSquare_3.jpg";
  9. image_url[2] = "images/Homepage/HomepageSquare_4.jpg";
  10. image_url[3] = "images/Homepage/HomepageSquare_5.jpg";
  11. image_url[4] = "images/Homepage/HomepageSquare_6.jpg";
  12. image_url[5] = "images/Homepage/HomepageSquare_7.jpg";
  13. image_url[6] = "images/Homepage/HomepageSquare_8.jpg";
  14. image_url[7] = "images/Homepage/HomepageSquare_9.jpg";
  15. image_url[8] = "images/Homepage/HomepageSquare_10.jpg";
  16.  
  17. for(var i=0, limit = image_url; i<limit; i++)
  18. {
  19. preload_image_object[i]=new Image();
  20. preload_image_object[i].src = image_url[i];
  21. }
  22. }
  23. }
  24. </script>
  25.  
  26.  
  27. <body onload="javascript:preload();">

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

图像预加载程序

图像预加载程序

jQuery图像预加载程序

小图像预加载程序

jQuery CSS图像预加载程序

带预加载程序的鼠标悬停图像交换