guvenck
06-11-2007, 03:34 PM
Hello,
I have a table with id="testblock" like this:
<table id="testblock" cellspacing="0" cellpadding="0">
<tr>
<th>Block Title</th>
</tr>
<tr>
<td>Any text here</td>
</tr>
</table>
I am trying to change the styles with Javascript and have no problems with the table related styles. But I can't change the styles of th and td elements.
/* these do work */
testblock.style.borderWidth = TableBorderWidth;
testblock.style.borderSpacing = TableBorderSpacing;
testblock.style.borderStyle = TableBorderStyle;
testblock.style.borderColor = TableBorderColor;
testblock.style.backgroundColor = TableBackgroundColor;
/* these do not */
testblock.th.style.padding = ThTdPadding;
testblock.th.style.backgroundColor = ThBackgroundColor;
testblock.th.style.color = ThColor;
testblock.td.style.padding = ThTdPadding;
How can I change the styles of th and td elements?
I have a table with id="testblock" like this:
<table id="testblock" cellspacing="0" cellpadding="0">
<tr>
<th>Block Title</th>
</tr>
<tr>
<td>Any text here</td>
</tr>
</table>
I am trying to change the styles with Javascript and have no problems with the table related styles. But I can't change the styles of th and td elements.
/* these do work */
testblock.style.borderWidth = TableBorderWidth;
testblock.style.borderSpacing = TableBorderSpacing;
testblock.style.borderStyle = TableBorderStyle;
testblock.style.borderColor = TableBorderColor;
testblock.style.backgroundColor = TableBackgroundColor;
/* these do not */
testblock.th.style.padding = ThTdPadding;
testblock.th.style.backgroundColor = ThBackgroundColor;
testblock.th.style.color = ThColor;
testblock.td.style.padding = ThTdPadding;
How can I change the styles of th and td elements?