Build a website with javascript games and other dynamic content

Step Five - preload image

To load an image even when it is not displayed can be done with something simliar to the next script


if (document.images)


        a = new Image(52, 53)

        a.src = "pix/2.gif" 

        b = new Image(52, 53)

        b.src = "pix/2on.gif" 



This is how in the page before the images where loaded in to the cache even when they were not displayed yet. This methode ensures smoother changes after the page is loaded completly, because the image can be retrieve from cache if needed. Obviously it will take longer to load the page in the beginning.

Next step



My Games

Get Games

Build Games
1 - simple javascripts
2 - change form values
3 - statusbar & mouse
4 - change images
5 - preload images
6 - change location
7 - open/close windows
8 - other sources

Feedback or Questions

about me


Copyright by Armin Kielack 1998 last modified: