Click to See Complete Forum and Search --> : changing content of a table cell
shelly
03-27-2000, 05:01 PM
Hi,
Does anyone know how to dynamically change the contents of a table cell in
Netscape? In IE, I put an 'id' on the cell,
<td id='id1'>
and then change the contents using document.all('id1').innerhtml.
I can't get this to work in Netscape. Do I have to make the <td> into a
layer?
thanks.
Ram Santhanam
03-28-2000, 04:28 PM
Try this sample code. Add the IE logic you have to make it cross browser compatible.
Good luck,
Ram
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<SCRIPT LANGUAGE=javascript>
<!--
n = (document.layers) ? 1:0
function changecol() {
if (n)
document.layers["lay1"].bgColor = "LemonChiffon";
}
function resetcol() {
if (n)
document.layers["lay1"].bgColor = "white";
}
//-->
</SCRIPT>
<Layer name="lay1">
<TABLE border=1 cellPadding=1 cellSpacing=1 style="HEIGHT: 27px; WIDTH: 20px"
width="25%">
<TR>
<TD>Sample Data</TD>
</TR>
</TABLE>
</Layer>
</HEAD>
<BODY>
<form>
<BR><BR><BR><BR>
<INPUT type="button" value="Change" id=button1 name=button1 onclick="changecol();">
<INPUT type="button" value="Reset" id=button2 name=button2 onclick="resetcol();">
</form>
</BODY>
</HTML>
devx.com
Copyright WebMediaBrands Inc. All Rights Reserved