0

I want to change image while mouseover and mouseout

MY Code :

<img src="convert.php?file=image.gif" title="Preview image"
   width="100" height="100" rel="image.gif"
   onmouseover="this.src=this.rel"
   onmouseout="this.src='convert.php?file='+this.rel" />

this.rel getting undefined. Please check and help me. :(

2
  • this.src=this.rel? never seen it before. Commented Oct 14, 2015 at 10:35
  • What are you expecting this.rel to be? I don't see any reason for it to have a value. Commented Oct 14, 2015 at 10:37

1 Answer 1

2
<img src="convert.php?file=image.gif" title="Preview image"
   width="100" height="100" rel="image.gif"
   onmouseover="this.src=this.getAttribute('rel')"
   onmouseout="this.src='convert.php?file='+this.getAttribute('rel')" />
Sign up to request clarification or add additional context in comments.

1 Comment

ur welcome.you can accept the answer if my answer helped you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.