<style> .main {color: blue; width: 200px; border: 1px solid blue; font-family: arial; font-size: 12px;} #head {background-color: blue; color: white; font-family: arial; font-size: 12px;} a:active {text-decoration: none;} a:hover {text-decoration: none;} </style> <script> function zmien () { kolor = document.getElementById("head"); kolor.style.background-color = "gray;" } </script> <div class='main'> Witoj na stronie!<br> Kliknij na nagłówek menu, aby zmienił kolor.<br> Gul, gul - powiedział indyk. </div>
Nie ma reakcji. Natomiast jeśli zastąpię w funkcji JS "background-color" na "color", to bardzo ładnie zmienia kolor tekstu. Nie rozumiem, dlaczego?