View Single Post
  #1 (permalink)  
Old 05-11-2008, 12:06 AM
ineuw ineuw is offline
Junior Member
 
Join Date: Dec 2007
Posts: 3
Default Text/background color change

I am trying to switch the background and text colors of a table cell, using these two simple javascript functions. It works on the background color, but it doesn't change the text color as this always remains black. The initial cell background/text colors are set by CSS, and here too the text color remains unaffected. (It should be a dark blue background with white text).

What am I doing wrong? Thanks for any help given.

// CSS

Code:
table.links td
{
font: 12px Tahoma;
color: #ffffff;
font-weight: normal;
background-color: #000080;
}
// mouseover script

Code:
var changed_background = "#ffffff";
var changed_foreground = "#000080";

var normal_background = "#000080";
var normal_foreground = "#ffffff";

function change_background(tcell)
{
tcell.style.backgroundColor = changed_background;
tcell.style.color = changed_foreground;
}

function reset_background(tcell)
{
tcell.style.backgroundColor = normal_background;
tcell.style.color = normal_foreground;
}
Reply With Quote