Results 1 to 2 of 2

Thread: Not A Simple Mouseover Text Color Change

  1. #1
    Join Date
    Mar 2009
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Not A Simple Mouseover Text Color Change

    There may be a simple answer to this but I don't know it. This is similar to a simple css hover color change with a twist.

    I have a list of 10 text links colored blue. I need the text color to change to red when a user hovers over it. Now for the tricky part. I need for this link to remain red once the user moves the cursor from the text.

    When the user hovers over another link, I need that link to turn red and the previously hovered link to reset to blue.

    Anyone know a simple way to accomplish this?

  2. #2
    Join Date
    Dec 2008
    Location
    Portsmouth, UK
    Posts
    1,891
    Thanks
    2
    Thanked 441 Times in 435 Posts

    Default

    Code:
    <html>
    
    <head>
      <title></title>
    <script type="text/javascript">
    
    var Lst=false;
    
    function Cng(obj){
     if (Lst) Lst.style.color='blue';
     Lst=obj;
     Lst.style.color='red';
    }
    
    </script>
    
    </head>
    
    <body>
    <a onmouseover="Cng(this);" >Tom</a>
    <br />
    <br />
    <a onmouseover="Cng(this);" >****</a>
    <br />
    <br />
    <a onmouseover="Cng(this);" >Harry</a>
    </body>
    
    </html>

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
  •