Hi,
I'm trying to add some events (onmouseover, onmouseout) to 4 links that are in a html list. Inside each link, there is an image. I want to swap the image on event!
Code:<ul id="menu"> <li><a id="home" href="#"><img src ="home.png" alt="" /></a></li> <li><a id="about" href="#"><img src ="about.png" alt="" /></a></li> <li><a id="product" href="#" ><img src ="product.png" alt="" /></a></li> <li><a id="contact" href="#"><img src ="contact.png" alt="" /></a></li> </ul>But all this doesn't work! Seem that the "i" value is buggy... I need some help thank!Code:function addEventListener() { //Variable Data var oMenu = document.getElementById('menu'); var oMenuLink = oMenu.getElementsByTagName('a'); for(var i = 0; i < oMenuLink.length; i++) { oMenuLink[i].onmouseover = function() { oMenuLink[i].images[0].src '???.png'; } } } window.onload = addEventListener;
turb




Bookmarks