Tungusv,
<!DOCTYPE HTML>
<html>
<head>
<title></title>
<meta charset="utf-8">
<style type="text/css">
td{
height: 22px; width: 22px; text-align: center;
}
</style>
</head>
<body >
<script>
function createTable(row, col, parent)
{
var table = document.createElement('table'), arr = [];
for (var i=0; i<row; i++) {
var tr = table.insertRow(i); arr[i] = [];
for (var j=0; j< col; j++) {
var td = tr.insertCell(j)
var color = ("000000" + (Math.random() * 16777215 | 0).toString(16)).slice(-6);
td.style.backgroundColor = "#" + color;
arr[i].push(color)
}
}
parent.appendChild(table)
return arr
}
var body = document.body;
var mas = createTable(3, 8, body);
console.log(mas);
</script>
</body>
</html>