Hola
PP2
Te pongo un ejemplo que no necesita usar id, espero que te sirva:
Código PHP:
<html>
<head>
<script type="text/javascript">
var celda = null;
function cambiar(obj) {
obj.style.background = '#f00';
if (celda) celda.style.background = '';
celda = obj;
}
</script>
</head>
<body>
<table>
<tr>
<td onclick="cambiar(this)">Uno</td>
<td onclick="cambiar(this)">Dos</td>
<td onclick="cambiar(this)">Tres</td>
</tr>
</table>
</body>
</html>
Saludos,