Click to See Complete Forum and Search --> : tables


demo
08-01-2003, 01:15 PM
ok say you hav this simple table:


<table>

<tr>
<td>Row1 Cell1 here</td>
<td>Row1 Cell2 here</td>
</tr>

<tr>
<td>Row2 Cell1 here</td>
<td>Row2 Cell2 here</td>
</tr>

</table>

ok now what is the code to access one of those cells. what i want to do is when a button is clicked, so a function started, row1 cell2 background colour changes.

i know that this part changes the colour:

.........style.backgroundColor="your color";

but i dont know the "....." bits, can anyone help?????

Exuro
08-01-2003, 02:06 PM
Try something like this:

<table>
<tr>
<td>Row1 Cell1 here</td>
<td id="r1c2">Row1 Cell2 here</td>
</tr>
<tr>
<td>Row2 Cell1 here</td>
<td>Row2 Cell2 here</td>
</tr>
</table>
<input type="button" value="click"
&nbsp;onclick="document.getElementById('r1c2').style.background='blue'" />

demo
08-01-2003, 02:12 PM
*************THANK YOU****************
*************THANK YOU****************
*************THANK YOU****************
*************THANK YOU****************
*************THANK YOU****************
*************THANK YOU****************
*************THANK YOU****************



you are a '*'.

it worked first time.

let me know if you need anything (although i might not know it as i am by no means an expert).