Javascript Swap Image

by "Emerson D. Champion" <champion(at)qis.net>

 Date:  Sun, 6 Jan 2002 19:52:12 -0500
 To:  "HWG-Languages" <hwg-languages(at)hwg.org>
  todo: View Thread, Original
First, the URL: http://www.standrewspasadena.com/photos.html

What's supposed to happen is that, when each link is clicked, the photo will
appear on the right. It works correctly when I use the preview function in
Dreamweaver. But when I upload the page & relevant images to the website,
they won't swap.

If you do view source in the browser, look for the JavaScript comment that
says, "Script to swap images into right table cell." Here's the short
version:

var photoArray= new Array()
photoArray[0]=new Image()
photoArray[0].src="images/photos/outside.gif"
function photoSwap(i)
 {
 document.churchPhoto.src=photoArray[i].src
 }

The image link is written like this:
<img src="images/photos/outside.gif" width="425" height="325"
name="churchPhoto">
hence the document.churchPhoto.src reference above, vice
document.images[i].src.

Each link is written like this:
<a href="javascript:" onClick="photoSwap(0);">Outside St. Andrew's</a>

There are 11 photos, so each item above is repeated 10 more times.

I've ensured I have the files uploaded to the correct directory; it's the
same directory structure as on my hard drive.
_____________________________________
Emerson D. Champion | champion(at)qis.net

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA