1. | In a separate text document, on the first line, type label=, where label is a word that identifies the image.
|
2. | Type new Image(h,w), where h and w are the image's height and width, in pixels.
|
3. | On the next line, type label, where label matches the label used in step 1.
|
4. | Directly following the name in step 3 (i.e., with no extra spaces), type .src="image.url", where image.url is the location of the image on the server.
|
5. | Repeat steps 14 for each image you wish to load into cache (Figure 20.11).

|
6. | Save the script in text-only format and call it loadimages.js.
|
7. | In the head section of the (X)HTML document that uses the images, type <script type="text/javascript" language="javascript" src="loadimages.js"> </script>, where loadimages.js is the name of the file you saved in step 6.
|
8. | When you refer to the images in other scripts, use label.src (without quotes), where label is the word you used to describe the images in step 1 (Figure 20.12).

|