PDA

View Full Version : Javascript Gone Bad Help!



corrosivebreath
05-17-2004, 11:26 PM
alright im trying to make a image swap here and it wont work!!!


<script language="Javascript1.1">
function yaImgChange(imgnum,imgsrc) {
document.images[11].src = img1.gif;
}
</script>
<a href="javascript:nothingMuch();"
onmouseover="javascript:yaImgChange(11,'img1.gif');"
onmouseout="javascript:yaImgChange(11,'img2.gif');"> <img
src="img1.gif"></a>

the code is located here (http://freewebs.com/corrosivebreath/mario.htm). Please help me out!!!! I can't get it to work!

sparsely
05-18-2004, 01:00 AM
you really don't need all that for just a mouseover...you can do it all in the anchor & img tags.
like:


<a href="#" onmouseover="document.home.src='images/l1_2.gif';" onmouseout="document.home.src='images/l1.gif';"><img name="home" alt="Welcome" src="images/l1.gif" /></a>

the &#39;home&#39; in document.home.src is just what you name the <img>, and the src of it will be the &#39;over&#39; image.