<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript">
window.onload= function() {
document.getElementById('table').onclick = function(event) {
event = event || window.event;
var target = event.target || event.srcElement;
if(target.tagName == 'INPUT') {
var cells = target.parentNode.parentNode.cells;
cells[1].innerHTML = cells[3].innerHTML = 'Y';
}
};
};
</script>
</head>
<body>
<table id="table">
<tbody>
<tr>
<td> </td>
<td>X</td>
<td> </td>
<td>X</td>
<td><input type="button" value="Edit" /></td>
</tr>
<tr>
<td> </td>
<td>X</td>
<td> </td>
<td>X</td>
<td><input type="button" value="Edit" /></td>
</tr>
<tr>
<td> </td>
<td>X</td>
<td> </td>
<td>X</td>
<td><input type="button" value="Edit" /></td>
</tr>
</tbody>
</table>
</body>
</html>
DOM: Работаем со строками и ячейками таблицы