HELP! * GREY=local LOCAL HTML version of Foils prepared 15 January 1997

Foil 64 More on Document Objects -- Image

From JavaScript Tutorial for CPS616 Technologies of the Information Age 1997 Basic Information Track of CPS -- Spring Semester 97. by Geoffrey C. Fox * Important Information in IMAGE

The document object has several important subobjects including Anchor, Applet, Area, Form, Image and Link.
It also has arrays anchors, applets, forms, images and links arrays holding all the occurrences of these objects in a particular document.
We have illustrated Form and Link already -- here we look at Image
<IMG NAME="fred" SRC="jim.gif" > in an HTML file generates an object document.fred of type Image with property document.fred.src="jim.gif"
One can preload images using syntax like:
  • image1 = new Image(); image1.src = "henry.jpg";
  • and then change Image in document using
  • document.fred.src = image1.src;
  • henry.jpg is fetched from cache and so this is fast!
This technology can be used for animated images and also to quickly change a picture displayed in perhaps an online shop catalog where user chooses a new item in a form.



Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Wed Feb 19 1997