Io avrei questo codice che più o meno ho creato (l'ho modificato da uno esistente)
codice:
<script language="Javascript">
<!--
function colore1(b_colore)
{
document.getElementById('par1').style.backgroundColor = b_colore;
}
function colore2(r_colore)
{
document.getElementById('par2').style.backgroundColor = r_colore;
}
function colore3(g_colore)
{
document.getElementById('par3').style.backgroundColor = g_colore;
}
function colore4(v_colore)
{
document.getElementById('par4').style.backgroundColor = v_colore;
}
-->
</script>
<table>
<tr>
<td rowspan="2"><input id="par1" style="background-color: #000; color: #fff; width: 50px; height: 50px;" type="button" value="1" OnClick="colore1('#0000FF')"></td>
<td><input id="par2" style="background-color: #000; color: #fff; width: 50px; height: 50px;" type="button" value="2" OnClick="colore2('#FF0000')"></td>
<td  rowspan="2"><input id="par3" style="background-color: #000; color: #fff; width: 50px; height: 50px;" type="button" value="3" OnClick="colore3('#ffff00')"></td>
</tr>
<tr>
<td><input id="par4" style="background-color: #000; color: #fff; width: 50px; height: 50px;" type="button" value="4" OnClick="colore4('#99cc00')"></td>
</tr>
</table>
Come faccio a fare in modo che 1 cambi colore a 3 e viceversa e 2 cambi il colore a 4 e viceversa?