Hola, Nizam.
No se si he entendido bien tu pregunta
![Pensando](http://static.forosdelweb.com/fdwtheme/images/smilies/scratchchin.gif)
pero a ver si esto te ayuda:
Código PHP:
<html>
<head>
<script>
function cambiaColor(objeto) {
objeto.style.backgroundColor="#0000ff";
}
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width="200" border="1" cellspacing="1">
<tr>
<td onClick="cambiaColor(this)"> </td>
<td onClick="cambiaColor(this)"> </td>
</tr>
<tr>
<td onClick="cambiaColor(this)"> </td>
<td onClick="cambiaColor(this)"> </td>
</tr>
</table>
</body>
</html>
Saludos,