JavaScript question -- onMouseOver event

Posted by alex_wang on Stack Overflow See other posts from Stack Overflow or by alex_wang
Published on 2010-04-10T02:17:55Z Indexed on 2010/04/10 2:23 UTC
Read the original article Hit count: 385

Filed under:
|

Why doesn't this piece of code swap images on mouse-over as intended?:

<a href="#" onMouseOver="
 if (document.the_image.src == '01.jpg')
 {
  document.the_image.src = '02.jpg';
 }
 else if (document.the_image.src == '02.jpg')
 {
  document.the_image.src = '03.jpg';
 }
 else
 {
  document.the_image.src = '01.jpg';
 }
 ">
Some image</a><br>

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about onmouseover