There are a variety of ways to do the image rotation.  The approach used here is to use a single function, number the images consecutively, and concatenate string constants with a variable representing the number of the image to form a URL.  Additionally setTimeout() is used with a recursive call to the function.  Other approaches would include the following:

  1. Use setInterval() instead of setTimeout(), eliminating the recursive function call
  2. Have a separate function for each image with one function calling the next using setTimeOut.

The solution to the frames portion of this exercise is not shown here but would be similar to the code sample discussed in class except that for two parts:

  1. one would replace document.write("Stuff to be written") with location.href="Page to be loaded", and
  2. there is no need to disable the default action of clicking the link, which is to load the page specified. One loads a page into one of the frames using standard HTML techniques and a page is loaded into another frame using the location.href JavaScript discussed above.  Alternatively, one could disable the default action and load both pages using JavaScript.
Revised: February 17, 2002