pornoborets,
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf8">
</head>
<body>
<table id="table">
<tr>
<td>Аа</td>
<td>Бб</td>
<td>Yy</td>
<td>Гг</td>
<td>Дд</td>
<td>Hh</td>
</tr>
<tr>
<td>Оо</td>
<td>Gg</td>
<td>Пп</td>
<td>Рр</td>
<td>Сс</td>
<td>Тт</td>
</tr>
</table>
<script>
f=function(a){return function() {
alert(a)
}}
;[].forEach.call(document.querySelectorAll("table td"), function(el,i){el.onclick=f(i)})
</script>
</body>
</html>