Voici le code js :
<script type="text/javascript">
<!--
window.onload=montre;
function montre(id) {
var d = document.getElementById(id);
for (var i = 1; i<=10; i++) {
if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
}
if (d) {d.style.display='block';}
}
//-->
</script>
Mon code css :
#menu,
#menu_bottom {
z-index:100;
font-size:14px;
height:20px;
background-image:url("../img/bg_menu.png");
background-repeat:repeat-x;
background-position:top;
padding:5px;
font-family:"Trebuchet MS", Tahoma, Arial, Helvetica, sans-serif;
text-transform:uppercase;
clear:both;
margin:1px 0px;
}
dl, dt, dd, ul, li {
margin: 0;
padding: 0;
list-style-type: none;
}
#menu dl {
float: left;
margin: 0 10px;
color:white;
}
#menu dt {
cursor: pointer;
text-align: center;
font-weight: bold;
border: 0;
color:white;
}
#menu dd {
border: 1px solid gray;
}
#menu li {
text-align: center;
background: #898989;
}
#menu li a, #menu dt a {
color:#FFFFFF;
font-weight:bold;
text-decoration:none;
display: block;
}
#menu li a:hover, #menu dt a:hover {
color:#898989;
background-color:white;
height:20px;
}
Et mon code html généré :
<div id="menu">
<dl>
<dt onmouseover="javascript:montre();"><a href="index.php?p=home" title="Retour à l'accueil">accueil</a></dt>
</dl>
<dl>
<dt onmouseover="javascript:montre('smenu1');" onmouseout="javascript:montre('');"><a href="cat-shop-1-pile.html">PILE</a></dt>
<dd id="smenu1" onmouseover="javascript:montre('smenu1');" onmouseout="javascript:montre('');">
<ul>
<li><a href="">test</a></li>
<li><a href="">test</a></li>
<li><a href="">test</a></li>
<li><a href="">test</a></li>
<li><a href="">test</a></li>
<li><a href="">test</a></li>
</ul>
</dd>
</dl>
<dl>
<dt onmouseover="javascript:montre('smenu2');" onmouseout="javascript:montre('');"><a href="cat-shop-17-pile-bouton.html">PILE BOUTON</a></dt>
<dd id="smenu2" onmouseover="javascript:montre('smenu2');" onmouseout="javascript:montre('');">
<ul>
<li><a href="">test</a></li>
<li><a href="">test</a></li>
<li><a href="">test</a></li>
<li><a href="">test</a></li>
<li><a href="">test</a></li>
<li><a href="">test</a></li>
</ul>
</dd>
</dl>
<dl>
<dt onmouseover="javascript:montre('smenu3');" onmouseout="javascript:montre('');"><a href="cat-shop-33-pile-rechargeable.html">PILE RECHARGEABLE</a></dt>
<dd id="smenu3" onmouseover="javascript:montre('smenu3');" onmouseout="javascript:montre('');">
<ul>
<li><a href="">test</a></li>
<li><a href="">test</a></li>
<li><a href="">test</a></li>
<li><a href="">test</a></li>
<li><a href="">test</a></li>
<li><a href="">test</a></li>
</ul>
</dd>
</dl>
<dl>
<dt onmouseover="javascript:montre('smenu4');" onmouseout="javascript:montre('');"><a href="cat-shop-40-chargeur-alimentation.html">CHARGEUR & ALIMENTATION</a></dt>
<dd id="smenu4" onmouseover="javascript:montre('smenu4');" onmouseout="javascript:montre('');">
<ul>
<li><a href="">test</a></li>
<li><a href="">test</a></li>
<li><a href="">test</a></li>
<li><a href="">test</a></li>
<li><a href="">test</a></li>
<li><a href="">test</a></li>
</ul>
</dd>
</dl>
<dl>
<dt onmouseover="javascript:montre('smenu5');" onmouseout="javascript:montre('');"><a href="cat-shop-47-batterie.html">BATTERIE</a></dt>
<dd id="smenu5" onmouseover="javascript:montre('smenu5');" onmouseout="javascript:montre('');">
<ul>
<li><a href="">test</a></li>
<li><a href="">test</a></li>
<li><a href="">test</a></li>
<li><a href="">test</a></li>
<li><a href="">test</a></li>
<li><a href="">test</a></li>
</ul>
</dd>
</dl>
<dl>
<dt onmouseover="javascript:montre('smenu6');" onmouseout="javascript:montre('');"><a href="cat-shop-50-eclairage.html">ECLAIRAGE</a></dt>
<dd id="smenu6" onmouseover="javascript:montre('smenu6');" onmouseout="javascript:montre('');">
<ul>
<li><a href="">test</a></li>
<li><a href="">test</a></li>
<li><a href="">test</a></li>
<li><a href="">test</a></li>
<li><a href="">test</a></li>
<li><a href="">test</a></li>
</ul>
</dd>
</dl></div>
Merci de ton aide !