Re: Change class problem
Harlan Messinger <hmessinger.removethis@comcast.net> wrote:
>Test wrote:
>> I want to change the color and text of a table cell when the cell is clicked.
>> Full code is below.
>> Problem is that text changes but the color does not.
>> When I run the code through Firefax Venkman debugger I see that the class is
>> changed but why is not the class color changing to what the class has set?
>>
>[snip]
>> td { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color:
>> #000000;}
>> td.onetype {
>> background-color: #F1F1F1;
>> border: 1px #000000 solid;
>> }
>[snip]
>> document.getElementById("one").parentNode.classNam e = "onetype";
>> document.getElementById("one").innerHTML="Works?";
>[snip]
>> <body><table border="1" cellspacing="2" cellpadding="4" width="200">
>> <tr>
>> <td class="another" id="one" onclick="zub()" width="20%">
>> Testing</td>
>> </tr></table></body>
>
>You're setting the class of the TD's *parent* and then expecting the
>result you'd get if you'd set the class of the TD itself.
my bad. I looked, looked and looked but could not see the obvious.
Thank you.
|