You don't need javascript for it.
a href="www.google.com"
onmouseover="nameHere.src='imgs/frog.jpg'"
onmouseout="nameHere.src='imgs/duck.jpg'"
img src="img/pig.jpg" name="nameHere" /a
Gah, i can't get around this forum messing with my code when i post it. Hopefully you understand this.