codice:
<script language="Javascript">
<!--
function colore(chi) {
c = ",yellow,blue,green,red".split(",")[chi];
o = document.getElementById("par"+chi).style.backgroundColor;
document.getElementById("par"+chi).style.backgroundColor = (o=="#000")?c:"#000";
}
-->
</script>
<table>
<tr>
<td rowspan="2"><input id="par1" style="background-color: #000; color: #fff; width: 50px; height: 50px;" type="button" value="1" onClick="colore(3)"></td>
<td><input id="par2" style="background-color: #000; color: #fff; width: 50px; height: 50px;" type="button" value="2" onClick="colore(4)"></td>
<td rowspan="2"><input id="par3" style="background-color: #000; color: #fff; width: 50px; height: 50px;" type="button" value="3" onClick="colore(1)"></td>
</tr>
<tr>
<td><input id="par4" style="background-color: #000; color: #fff; width: 50px; height: 50px;" type="button" value="4" onClick="colore(2)"></td>
</tr>
</table>