Jump to content

Image roll overs


Cronthenoob

Recommended Posts

I've got this bit of javascript I use to change an image to another image when the mouse goes over it. But i've got a special situation where I need the image to stay in the mouseover state while over certain links, then goes back to normal. The code I have now changes the image on mouseover, but doesnt change it back. I can make the image change to the original, however, when the mouse moves from the image, it changes immediatly. I only want it to go back to normal when the drop down menu dissappears.Heres the broken example

<script type="text/javascript">	function init() {   if (!document.getElementById) return   var imgOriginSrc;   var imgTemp = new Array();   var imgarr = document.getElementsByTagName('img');   for (var i = 0; i < imgarr.length; i++) {  if (imgarr[i].getAttribute('hsrc')) { 	 imgTemp[i] = new Image(); 	 imgTemp[i].src = imgarr[i].getAttribute('hsrc'); 	 imgarr[i].onmouseover = function() {    imgOriginSrc = this.getAttribute('src');    this.setAttribute('src',this.getAttribute('hsrc')) 	 }  }   }	}	onload=init;</script>

Link to comment
Share on other sites

  • 5 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...