[thelist] Javascript - image swap not working on NS 4.75 Mac

Tara Cleveland tara at taracleveland.com
Thu Nov 28 16:09:00 CST 2002


Hi all,

I'm tearing my hair out. I've got an image swap thingy that isn't working on
NS 4.75 for Mac, but seems to work fine everywhere else.

It's supposed to replace the main image with a different image when you
click on a thumbnail. I don't know if I'm overlooking something totally
basic, or what. If one of you JavaScript gurus could look it over and tell
me what I'm doing wrong that would be great.

Thanks in advance,
Tara


Here's a stripped down version of the page:

-----------------------------------

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html lang="en">
<head>
<script language="JavaScript">
    <!--

    function thePreload()
{

   var imgs = new Array('mainimage1.jpg',
  'mainimage2','mainimage3.jpg');
   preloadImages(imgs);
}

function preloadImages(imgsarray) {

   for(var loop = 0; loop < imgsarray.length; loop++)

   {
     var animage = new Image();
    animage.src = imgsarray[loop];
   }
}

    -->
</script>
</head>
<body bgcolor="#ffffff" onLoad="thePreload();">

        <!--this is where the main image and thumbnails are-->

        <img src="mainimage1.jpg"  name="mainImage">
        <br>
        <a href="#"  onClick="document.mainImage.src='mainimage1.jpg'"><img
src="thumb1.jpg"></a><br><br>
        <a href="#"  onClick="document.mainImage.src='mainimage2.jpg'"><img
src="thumb2.jpg"></a><br><br>
        <a href="#"  onClick="document.mainImage.src='mainimage3.jpg'"><img
src="thumb3.jpg"></a>
</body>
</html>
-----------------------------------




More information about the thelist mailing list