You are here: irt.org | FAQ | JavaScript | Image | Q282 [ previous next ]
The following will load images name image1.gif through to image9.gif one at a time for browsers that support the JavaScript image object:
<SCRIPT LANGUAGE="JavaScript"><!-- function next() { if (++no < 10) load(); } function load() { img[no] = new Image(); img[no].onload = next; img[no].src = 'image' + no + '.gif'; } if (document.images) { var img = new Array(10), no = 1; load(); } //--></SCRIPT>