Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-26-2002, 11:59 AM   PM User | #1
Florens
New to the CF scene

 
Join Date: Jul 2002
Location: Almere, the Netherlands
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Florens is an unknown quantity at this point
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
Florens is offline   Reply With Quote
Old 07-26-2002, 01:14 PM   PM User | #2
mordred
Senior Coder


 
Join Date: Jun 2002
Location: frankfurt, german banana republic
Posts: 1,848
Thanks: 0
Thanked 0 Times in 0 Posts
mordred is an unknown quantity at this point
<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.
mordred is offline   Reply With Quote
Old 07-26-2002, 02:24 PM   PM User | #3
Florens
New to the CF scene

 
Join Date: Jul 2002
Location: Almere, the Netherlands
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Florens is an unknown quantity at this point
I tested it in IE 6 and it didn't work, maybe a syntax error, I'll try again.

Thanks
__________________
Florens
Florens is offline   Reply With Quote
Old 07-26-2002, 08:43 PM   PM User | #4
Roy Sinclair
Senior Coder

 
Join Date: Jun 2002
Location: Wichita
Posts: 3,880
Thanks: 0
Thanked 0 Times in 0 Posts
Roy Sinclair will become famous soon enough
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.
Roy Sinclair is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:57 PM.


Advertisement
Log in to turn off these ads.