# Preload images

**URL:** <https://forum.kirupa.com/t/preload-images/3365>\
**Category:** flash\
**Created:** [June 5, 2001, 3:25pm UTC](https://forum.kirupa.com/t/preload-images/3365 "2001-06-05T15:25:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 5, 2001, 3:25pm UTC](https://forum.kirupa.com/t/preload-images/3365/1 "2001-06-05T15:25:54Z")

</div>

hi,

i’ve got a javascript question. i have a dropdown menu that i am placing on every page of my site. i don’ write the code for the menus on each page, rather i use an include file.

there are 13 images associated with the menu (trigger buttons, transparent gif, etc…). how can i preload these 13 images on each page of the site without having to use the onLoad function in the body tag and having to write 13 images on each page.

can i write a javascript function that’ll load these images by using an array?

i.e.

function loadImage() {  
img[1] = new Image  
img[1].src =

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 6, 2001, 12:13am UTC](https://forum.kirupa.com/t/preload-images/3365/2 "2001-06-06T00:13:11Z")

</div>

Hey fumeng,  
You are exactly correct. You need to use arrays to preload images. For a good site I found on this topic, visit: [htmlgoodies.earthweb.com/…lflip.html](http://htmlgoodies.earthweb.com/beyond/dualflip.html)
