Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jul 2002
    Location
    Almere, the Netherlands
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Changing textcolor on MouseOver

    Hi,

    I'm new to JavaScript so this may sound stupid, but I can't change my textcolor on mouseover.

    This is my code:
    <td class="linkCursor">
    <a onClick="top.window.close()" onMouseover="this.style.fontColor='blue'">Sluit
    venster</a></td>

    The linkCursor class only changes the cursor into a hand so that it looks like a regular link.

    I've looked on a tutorial site and came up with the this.style.backgroundColor='blue' but it seems fontColor does not work. Nor does color or textColor by the way.

    Thanks a lot,

    Florens
    Florens

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <a onClick="top.window.close()" onMouseover="this.style.color='blue'">Sluit
    venster</a>

    This works for me in IE5.5 and Mozilla 1.0. Probably you tested this in NN4.7, but this syntax to manipulate styles on the fly is not (and will never) be supported by NN4 or older browsers.

  • #3
    New to the CF scene
    Join Date
    Jul 2002
    Location
    Almere, the Netherlands
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I tested it in IE 6 and it didn't work, maybe a syntax error, I'll try again.

    Thanks
    Florens

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I tried what Modred gave you and it worked just fine. Since NS4 doesn't seem to be an issue why not use pure CSS instead of Javascript in the first place:

    Code:
    ... in the <head>
    <style type="text/css">
    a.hotlink:hover { color: blue; }
    </style>
    
    .. in the <body>
    
    <a onClick="top.window.close()" id="hotlink">Sluit venster</a>
    Of course the code above will also cause the link to revert when the mouse move off of it.


  •  

    Posting Permissions

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