Changer la couleur de fonds au survol de la souris

Description
Publicité
Solution <!-- Exemple avec onmouseover -->
<table>
<tr onmouseover="javascript:document.getElementById('idtd').style.backgroundColor='#fafafa';">
<td id="idtd">Texte 1</td>
</tr>
</table>

<!-- Exemple avec onmouseover et onmouseout -->
<table>
<tr onmouseover="javascript:document.getElementById('idtd').style.backgroundColor='#fafafa';" onmouseout="javascript:document.getElementById('idtd').style.backgroundColor='#fff';">
<td id="idtd" style="background-color:#fff;>Texte 1</td>
</tr>
</table>
Notez la solution
1.6/5 (200 votes)
Partagez cette question
Questions similaires
Changer une image au survol de la souris
Mots clés javascript, onmouseover, onmouseout, background-color, backgroundColor, style, couleur
Derniére modification le 17/04/08 à 22:16