JavaScript Tutorial Question

by "Denise" <denise(at)nf.sympatico.ca>

 Date:  Thu, 23 Sep 1999 23:02:41 -0300
 To:  <hwg-basics(at)mail.hwg.org>
  todo: View Thread, Original
I'm just starting to learn JavaScript, and I'm using the Web Monkey tutorial
as my starting point. I got through the tutorial pretty well until it came
to the image swapping 'homework'. I couldn't get it to work after over an
hour of trying, so I took a peek at the code (cheating, I know) Even with
the code in front of me, I still am not quite sure whats going on in this
script.

What exactly does this line do?
 onMouseOver="temp=image1; image1=image2; image2=image3; image3=temp;
document.the_image.src=image1;"
onClick="document.brand_image.src=image1;">


Here's the full script.....

<script language="javascript">
<!-- hide it

var temp = "";
var image1 = 'thau.gif';
var image2 = 'sky.gif';
var image3 = 'monkey.gif';
-->
</script>

</head>
<body>
<div align="center">
<img src= "monkey.gif" name="brand_image">
</div>
<div align="right">
<a href="#"
onMouseOver="temp=image1; image1=image2; image2=image3; image3=temp;
document.the_image.src=image1;"
onClick="document.brand_image.src=image1;">
<img src="monkey.gif" name="the_image" border=0></a>


Any help with this, on or off list, would be really appreciated.


Thanks,

Denise
denise(at)nf.sympatico.ca

HTML: hwg-basics mailing list archives, maintained by Webmasters @ IWA