sasarivera
05-29-2002, 04:15 PM
Hi,
I have a table very simple.
Section 1 2 3 4 (1 row, 5 cols)
Initially the tds have backgroundcolor white, I just want to change the color through javascript, but is not working.
First I tried with span:
<table>
<tr><td>Section</td>
<td><span id="s1">1</span></td>
<td><span id="s2">2</span></td>
<td><span id="s3">3</span></td>
<td><span id="s4">4</span></td></tr>
</table>
...
My javascript was something like:
s1.style.backgroundcolor = "#5593bf";
The problem was only the number's backgound changed, I need to change the TD's background.
so, I tried assigning the ID to the TD, but nothing happens. Any Ideas???
Thanks in advance for your help.
I have a table very simple.
Section 1 2 3 4 (1 row, 5 cols)
Initially the tds have backgroundcolor white, I just want to change the color through javascript, but is not working.
First I tried with span:
<table>
<tr><td>Section</td>
<td><span id="s1">1</span></td>
<td><span id="s2">2</span></td>
<td><span id="s3">3</span></td>
<td><span id="s4">4</span></td></tr>
</table>
...
My javascript was something like:
s1.style.backgroundcolor = "#5593bf";
The problem was only the number's backgound changed, I need to change the TD's background.
so, I tried assigning the ID to the TD, but nothing happens. Any Ideas???
Thanks in advance for your help.