Table Cell background Color Example : Cell « Table « JavaScript DHTML






Table Cell background Color Example

 
    
<html>
<head>
<script>
    function function1() {
        document.all.myTD.bgColor = "red";
    }
    function function2() {
        document.all.myTD.bgColor = "";
    }
</script>
</head>
<body bgcolor="#ccffcc" text="#000000">
<table>
   <tr>
       <td id="myTD" height="79">Cell 1 content</td>
       <td height="79">Cell 2 content</td>
   </tr>
</table>
<input type="button" value="Add background color to Cell 1" onClick="function1();">
<input type="button" value="Remove background colors" onClick="function2();">
</body>
</html>

    
      
        
  








Related examples in the same category

1.Table Cell 'background' Example
2.Delete a Cell
3.Insert Cell Example
4.Table cell Index Example
5.Table cell Spacing Example
6.Table 'cellPadding' Example
7.Inserrt a table cell