View Full Version : Change text color on image mouse over
lord22
07-29-2008, 12:59 PM
Hi
I have an image and some text that are both links (they are separated links..).
I want that on mouseover on the image, the text link will change its color.
How can I do it?
thanks!
jscheuer1
07-29-2008, 01:15 PM
<img src="whatever.jpg" onmouseover="document.getElementById('some_id').style.color='red';">
<a id="some_id" href="some.htm">Text</a>
The image may be linked as well, makes no difference. I'd assume that onmouseout of the image though, you would want the link to revert:
<img src="whatever.jpg" onmouseover="document.getElementById('some_id').style.color='red';"
onmouseout="document.getElementById('some_id').style.color='';">
The link's (some_id) initial color (if different than the default) should be set in a stylesheet.
Can you please give me your code?
But what you'd want to do is either use CSS, or JavaScript.
Css: http://www.w3schools.com/css/css_pseudo_classes.asp
Javascript: http://www.w3schools.com/HTMLDOM/met_doc_getelementbyid.asp
I took a break in the middle of writing this post for food, guess John beat me.
lord22
07-29-2008, 01:27 PM
Thank you very much!
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.