potresti fare qualcosa del genere

premetto di non conoscere javascript

codice:
<head>

<script language="javascript">
function changecol(){
  if(this.style.backgroundColor=='#000000'){
    this.style.backgroundColor='#FF0000';
  }
  else{
    this.style.backgroundColor='#000000';
  }
}
</script>

</head>
<body>

   <table>
      <td onClick="changecol();"> ... </td>
      <td onClick="changeCol();"> ... </td>
   </table>

</body>
prova non prometto nulla