<style>
td {border: solid 1px; cursor: pointer}
</style>
<table id="myTable">
<tr>
<td id="1">first
<td id="2">second
<td id="3">third
<tr>
</table>
<script>
myTable.onclick = function (e) {
var e = e || window.event;
var target = e.target || e.srcElement;
target.innerHTML = target.id
}
</script>