I've been trying to make a html link <a> change an image right below the link. I need to do this for about 5 links (Navigation menu) and all the code I seem to stumble on and try does not work.
I have found the below code that works however it's setup to only replace ONE image. How can I set this up to accommodate about 4 more?
Javascript to make it all work
Link For Nav MenuCode:<script> function changeimage(towhat,url){ if (document.images){ document.images.targetimage.src=towhat.src gotolink=url } } function warp(){ window.location=gotolink } </script> <script language="JavaScript1.1"> var myimages=new Array() var gotolink="#" function preloadimages(){ for (i=0;i<preloadimages.arguments.length;i++){ myimages[i]=new Image() myimages[i].src=preloadimages.arguments[i] } } preloadimages("images/Header_Hover_23.png","images/Header_23.png") </script>
Image CodeCode:<a href="#" onMouseover="changeimage(myimages[0],this.href)" onMouseout="changeimage(myimages[1],this.href)">Work</a>
Code:<a href="javascript:warp()"><img src="images/Header_23.png" name="targetimage" border=0></a>


Reply With Quote

Bookmarks