Alemoppo, cambiando il codice, il bottone non riceve l'evento.
Il codice è questo:
Codice HTML:
<script type="text/javascript" language="Javascript">
function change color()
{
var color body = yellow
var new color body = blue
document.getElementById('body').style.background-color = "blue;"));
}
window.onload = function()
{
button = document.getElementById("change color");
button.addEventListener("click", change color, false);
}
</script>
mentre, per il bottone:
Codice HTML:
<button id="change color" class="change color" name="change color">Cambia il colore del body</button>