Page 1 of 1

fontColor JavaScript issue

Posted: Wed Mar 17, 2004 9:10 am
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

Re: fontColor JavaScript issue

Posted: Wed Mar 17, 2004 10:11 am
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.

Posted: Wed Mar 17, 2004 10:16 am
by Steveo31
Wrong forum!