Results 1 to 4 of 4

Thread: Change text color on image mouse over

  1. #1
    Join Date
    Jul 2008
    Posts
    81
    Thanks
    38
    Thanked 2 Times in 2 Posts

    Default Change text color on image mouse over

    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!

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Code:
    <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:

    Code:
    <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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. The Following User Says Thank You to jscheuer1 For This Useful Post:

    lord22 (07-29-2008)

  4. #3
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    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...lementbyid.asp
    Edit: I took a break in the middle of writing this post for food, guess John beat me.
    Jeremy | jfein.net

  5. #4
    Join Date
    Jul 2008
    Posts
    81
    Thanks
    38
    Thanked 2 Times in 2 Posts

    Default

    Thank you very much!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •