an.semionov, а чуть самостоятельности?
<!DOCTYPE html>
<html>
<head>
<title>test</title>
<style type="text/css">
</style>
<script type="text/javascript">
function numberCells() {
var o=document.getElementById('oTable');
var count=0;
for (i=0; i < o.rows.length; i++) {
for (j=0; j < o.rows[i].cells.length; j++) {
o.rows[i].cells[j].innerHTML = count;
count++;
}
}
}
</script>
</head>
<body onload="numberCells()">
<TABLE id='oTable' border=1>
<TR><TH> </TH><TH> </TH><TH> </TH><TH> </TH></TR>
<TR><TD> </TD><TD> </TD><TD> </TD><TD> </TD></TR>
<TR><TD> </TD><TD> </TD><TD> </TD><TD> </TD></TR>
</TABLE>
</body>
</html>