Changement du Background en Rollover
Bonjour, Je cherche à faire des essais et là je bloque:
Je souhaiterai faire un rollover sur un lien et modifier le background de la balise body:
Ça ne fonctionne pas :
Code:
1 2 3 4 5 6 7
| body {
background-color: yellow;
}
<body>
<a href="#" onmouseover="document.getElementsByTagName('body').style.backgroundColor='Blue';"
onmouseout="document.getElementsByTagName('body').style.backgroundColor='yellow';">lien</a></body> |
Ça fonctionne :
Code:
1 2 3 4 5 6 7
| #er {
background-color: yellow;
}
<body id="er">
<a href="#" onmouseover="document.getElementById('er').style.backgroundColor='Blue';"
onmouseout="document.getElementById('er').style.backgroundColor='yellow';">lien</a></body> |
Ça ne fonctionne pas :
Code:
1 2 3 4 5 6 7
| body {
background-image: url(img1.jpg);
}
<body>
<a href="#" onmouseover="document.getElementsByTagName('body').style.backgroundImage=url('img2.jpg');"
onmouseout="document.getElementsByTagName('body').style.backgroundImage=url('img1.jpg');">lien</a></body> |
Merci pour vos réponses