PDA

Click to See Complete Forum and Search --> : How to change the text of a table cell with DHTML


Oct 8th, 2000, 09:45 PM
Hi there, I would like to get the proper syntax to change the text value of a cell wihtin a table. I was thinking that I could do it like this but it didn't quite work:

<table id="mytable" border="1" cellspacing="1" width="500"
<tr>
<td id="A1" width="50" align="center" text="Monday"></td>
<td id="A2" width="50" align="center" text="Tuesday"></td>
<td id="A3" width="50" align="center" text="Wednesday"><td>
</tr>
</table>

<input id= buton1 type="button" value="change Day">


sub button1_onclick()
mytable.cells.item(A1).style.text = "Saturday"
end sub

I know the above syntax isn't quite right but if you understand what I'm trying to do, please send your suggestions for a better way to do it.

monte96
Oct 8th, 2000, 09:53 PM
<HTML>
<HEAD>
<SCRIPT language="vbScript">
<!--
Sub button1_onclick
mytable.cells.item("A1").innertext = "Saturday"
End Sub
-->
</SCRIPT>
</HEAD>
<BODY>
<TABLE id="mytable" border="1" cellspacing="1" width="500"
<TR>
<TD id="A1" width="50" align="center">Monday></TD>
<TD id="A2" width="50" align="center">Tuesday></TD>
<TD id="A3" width="50" align="center">Wednesday><td>
</TR>
</TABLE>
<INPUT id=button1 type="button" value="Change Day">
</BODY>
</HTML>


You were close...