fontColor JavaScript issue

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
mjseaden
Forum Contributor
Posts: 458
Joined: Wed Mar 17, 2004 5:49 am

fontColor JavaScript issue

Post by mjseaden »

Dear All,

I can't post the code for this as there's a lot of lines within the table I am using JavaScript to control.

But the basic scenario is, I have a picture (thumbnail), below which I have a caption. One of my mates who works in the web development department of a company told me that I could link them via the following code of the following form:

Code: Select all

<table id="um"  onmouseover="javascript:document.getElementById('um').style.fontSize='20px'"  onmouseleave="javascript:document.getElementById('um').style.fontSize='16px'">
<tr><td><a href="hello">fqwopifewpoif</a></td></tr>
<tr><td><a href="hello">rgeoijgrepoi</a></td></tr>
</table>
It's fairly simple to read.

Now when I'm actually implementing this into my site, there is some PHP code generating the appropriate caption within the table, and in my case, I want the font color of the caption to be white at first, then red with mouse over either the picture or the caption text, and then if the mouse is taken off, for the text to go back to white again.

I've tried using this same concept but changing the fontSize property to fontColor and putting in the appropriate color values. However, whilst the picture and the caption are now linked (i.e. clicking on the picture is now equivalent to clicking on the caption and vice-versa), the color of the caption text does not change.

I don't know JavaScript color formats, which might be the problem - I am using standard hex for the font colors? However, there might also be another issue, and if any of you have had problems similar to this, from experience can you tell me what was causing it?

Again many thanks

Mark
TheBentinel.com
Forum Contributor
Posts: 282
Joined: Wed Mar 10, 2004 1:52 pm
Location: Columbus, Ohio

Re: fontColor JavaScript issue

Post by TheBentinel.com »

Try "color" instead of "fontColor".

I haven't tried it, I'm pulling it from this web site:
http://developer.irt.org/script/120.htm

That's about the best javascript how-to reference I've ever found.
Steveo31
Forum Contributor
Posts: 416
Joined: Sun Nov 23, 2003 9:05 pm
Location: San Jose CA

Post by Steveo31 »

Wrong forum!
Post Reply