Voici le code pour ne pas voir les sous menu
(smenu : c'est le nom de ma variable .. )
document.write('<style type="text/css">#smenu1, #smenu2, #smenu3, #smenu4, #smenu5 {display:none;}</style>');
et voici un javascript complet :
document.write('<style type="text/css">#smenu1, #smenu2, #smenu3, #smenu4, #smenu5, #smenu6, #smenu7, #smenu8, #smenu9 {display:none;}</style>');
window.onload=montre;
function montre(id) {
var d = document.getElementById(id);
for (var i = 1; i<=9; i++) {
if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
}
if (d) {d.style.display='block';}
}
et sa feuille de style :
#menu {
position:absolute;
left:3px;
font-size:11px;
font-weight:800;
top:195px;
z-index:100;
font-family:Arial, Helvetica, sans-serif;
width:770px;
height:20px;
}
#menu dl {
float:left;
width:85px;
}
#menu dt {
cursor:pointer;
text-align:center;
font-weight:bold;
background:#FFFFFF;
border:1px solid gray;
margin:1px;
}
#menu dd {
background:#000000;
}
#menu li {
text-align: center;
background: #000000;
}
#menu li a, #menu dt a {
color:#FFFFFF;
text-decoration: none;
display: block;
height: 100%;
border: 0 none;
}
#menu li a:hover, #menu dt a:hover {
background:#333333;
}
bonen chance