Urgent comment change couleur d'autre cellule

hacheminfo -  
 hacheminfo -
Bonjour,

je veux changer le background d'une cellule d'un tableau en passant la souris sur une autre cellule

exemple

<table border='0' align='center' cellpadding='0' cellspacing='0' height='38' class='btn_menu'>
<tr>
<td class='btn_menu' id='btn_menu_1' width='10' > </td>
<td class='btn_menu' id='btn_menu_2' align='center' ><a id='contact_hor' href='contact.php'> Contact</a></td>
<td class='btn_menu' id='btn_menu_3' width='9' > </td>
</tr>
</table>

Style CSS

.btn_menu:hover {
je veux changer le background de cellule 1 par la couleur jaune
je veux changer le background de cellule 2 par la couleur bleu
je veux changer le background de cellule 3 par la couleur rouge
}

SVP aidez-moi... et un grand merciiiiiiiiii

2 réponses

  1. lolo1901 Messages postés 7 Statut Membre 1
     
    pour changer le fond de la cellule que tu survole, utilise l'id de la cellule :

    #btn_menu_1:hover{
    background-color:yellow;
    }

    si tu veux changer le fond d'une autre cellule, utilise le javascript avec l'event onMouseOver sur la cellule que tu survole et après tu change le fond de l'autre cellule avec document.getElementById('cellule1').style = "background-color:yellow";
    0
    1. hacheminfo
       
      merciiiiiiiiiii ça marche bien ami :))
      0
  2. mozer
     
    Salut! essaye ca!

    <table border='1' align='center' cellpadding='0' cellspacing='0' height='38' class='btn_menu'>
    <tr>
    <td onmouseover="this.style.background='#ffff00'" onmouseout="this.style.background=''" width='10'> celule1</td>
    <td onmouseover="this.style.background='#0000ff'" onmouseout="this.style.background=''" align='center' ><a id='contact_hor' href='contact.php'> Contact</a></td>
    <td onmouseover="this.style.background='#ff0000'" onmouseout="this.style.background='green'" width='9' >celule3 </td>
    </tr>
    </table>

    ou

    <table border='1' align='center' cellpadding='0' cellspacing='0' height='38' class='btn_menu'>
    <tr>
    <td onmouseover="this.className='CelOver1'" onmouseout="this.className='CelOut1'" width='10'> celule1</td>
    <td onmouseover="this.className='CelOver2'" onmouseout="this.className='CelOut2'" align='center' ><a id='contact_hor' href='contact.php'> Contact</a></td>
    <td onmouseover="this.className='CelOver3'" onmouseout="this.className='CelOut3'" width='9' >celule3 </td>
    </tr>
    </table>

    <style>
    .CelOver1 { background:#ffff00}
    .CelOout1 { background:}
    .CelOver2 { background:#ff0000}
    .CelOout2 { background:}
    .CelOver3 { background:#ff0000}
    .CelOout3 { background:green}
    </style>
    0