Inserrt a table cell : Cell « Table « JavaScript DHTML






Inserrt a table cell

  
<html>
<head>
<title>Build-o-Table</title>
<script type="text/javascript">
function procImage() {
   var tbl = document.getElementById('table1');
   tbl.border="5px";
   tbl.cellPadding="5px";

   var row1 = tbl.insertRow(-1);
   var cell1 = row1.insertCell(0);
   var cell2 = row1.insertCell(1);
   
   var txtAttr1 = document.createTextNode("src");
   cell1.appendChild(txtAttr1);
   
} 
</script>
<body onload="procImage();">

<table id="table1">
<tr><td>adsf</td></tr>
</table>
</body>
</html>

   
    
  








Related examples in the same category

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