Notice: Undefined index: HTTP_USER_AGENT in /home/grailgod/ozoneasylum.com/shared/grailapi2.php on line 1468 How do I preload images with Javascript? — OZONE Asylum, home of the Mad Scientists
It is often important to do this especially if you are using big rollover images.
The basic principle (i.e. if you wanted to preload a single image) is:
code:
var preloadImg = new Image();
preloadImg.src = "/folder/my_graphic.gif";
To load more than one image you would then need to create an array which runs through all the different graphics and preload them (see resources below for variations on the general theme).