changing content of a table cell


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: changing content of a table cell

  1. #1
    shelly Guest

    changing content of a table cell


    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.

  2. #2
    Ram Santhanam Guest

    Re: changing content of a table cell


    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>


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center