i'm struggling to understand how to make a function that changes a specific image on a page when the user chooses from a menu, but only if the src name matches "transparent.gif"
With numerous other scripts, I've cornered myself into this as the only solution for now to what I'm trying to do. But the script is not working. Here it is:
Code:<script> function changecolor(picName,imgName) { var leafcolor = document.getElementById('pic4').src; if (leafcolor = "/images/leaf_shapes/entire/transparent1.gif") { imgOn = eval(imgName + ".src"); document[picName].src= imgOn; } } image28= new Image(250,350); image28.src="/images/leaf_shapes/leafbg_green.gif"; </script> <!-- here's the image to change --> <IMG SRC="http://www.sitepoint.com/forums/images/leaf_shapes/entire/transparent1.gif" name="pic4" width="250" height="350" border="0"> <!-- here's where they've selected --> <li><a href="javascript:passit('auriculate')" onMouseover="change1('pic1','image2')" onClick="ShowContent('uniqueleaf'); ShowContent('uniquename'); changecolor('pic4','image28'); add_content('auriculate');" onMouseout="change1('pic1','image46');">Auriculate</a></li>


Reply With Quote



Bookmarks