Adding cells to a table row : Table : HTML JAVASCRIPT DHTML TUTORIALS


JAVASCRIPT DHTML TUTORIALS » HTML » Table »

 

Adding cells to a table row




<html>
<head>
<script type="text/javascript">
function addCell(){
    var x=document.getElementById('myTable').rows[0]
    var y=x.insertCell(2)
    y.innerHTML="NEW CELL"
}
</script>
</head>

<body>
<table id="myTable" border="1">
<tr>
<td>d</td>
<td>d</td>
</tr>
<tr>
<td>d</td>
<td>d</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
</tr>
</table>
<form>
<input type="button" onclick="addCell()" value="Add cell">
</form>
</body>

</html>



           
       



-

Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

JAVASCRIPT DHTML TUTORIALS

 Navioo HTML
» Table