Can only one image be animated using javascript?

schuyler

New member
I recently tried using javascript in animating an image. It worked out fine at first, but when I used the same code (except I changed the document.getElementById tag thing into (b2)-- it was b1 at first), only the b2 ID worked. Can anyone explain why?
<script type="text/javascript">
function mouseOver()
{
document.getElementById("B1").src ="homeb2.png";
}
function mouseOut()
{
document.getElementById("b1").src ="homeb1.png";
}

function mouseOver()
{
document.getElementById("b2").src ="aboutb2.png";
}
function mouseOut()
{
document.getElementById("b2").src ="aboutb1.png";
}
</script>

and I used it in this part of the <body>

<td>
<img border="0" src="aboutb1.png" id="b2" width="100" height="20"
onmouseover="mouseOver()" onmouseout="mouseOut()" />
</td>

yeah. I'm a total noob at Javascript. :D
 
Source please? You have to get each element separately if that helps any... its ID, or even not capitalizing it right coulda done some pretty serious damage to your code.
 
Back
Top