var tdCount = 10;
function createTable()
{
var x = window.addTable;
create(x.tBodies[0] || x,5);
create(x.createTHead(),2);
create(x.createTFoot(),3);
function create(section, trCount)
{
var n;
for(var i=0,tr; i<trCount; i++)
{
tr = section.insertRow(i);
tr.onclick = function aber(){x.deleteRow(this.rowIndex);}
for(var j=0; j < tdCount; j++)
{
n = tr.insertCell(j);
n.innerHTML = "Done";
}
}
}
}
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>TEST</title>
<style>
table{
border-collapse: collapse;
}
td{
padding:10px;
border: 1px solid black;
}
caption{
background: #f40;
padding:0 50px;
margin:50px 0 0;
border: 1px solid black;
border-bottom-width: 1px;
}
</style>
<script>
var tdCount = 10;
function createTable()
{
var x = window.addTable;
create(x.tBodies[0] || x,5);
create(x.createTHead(),2);
create(x.createTFoot(),3);
function create(section, trCount)
{
var n;
for(var i=0,tr; i<trCount; i++)
{
tr = section.insertRow(i);
tr.onclick = function aber(){x.deleteRow(this.rowIndex);}
for(var j=0; j < tdCount; j++)
{
n = tr.insertCell(j);
n.innerHTML = "Done";
}
}
}
}
</script>
</head>
<body>
<a href="javascript:createTable()">Ավելացնել շարք</a>
<table id="addTable">
<caption>Աղյուսակ</caption>
</table>
</body>
</html>