DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  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>


Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links