Retrouvez les publications relatives à ces discussions dans
notre rubrique javascript.
liste des forums
liste des discussions
Participer à la discussion
-
Message publié le vendredi 14 mars 2008 à 14 h 52 par davredom. [;-))] .:: Dom ::.
-
Bonjour,
Voici mon script :
<html>
<body>
<script type="text/javascript">
bgcolor='#7b7b7b';
bgcolor2='#ffffff';
document.write('<style type="text/css">');
document.write('.popper { POSITION: absolute; VISIBILITY: hidden; z-index:3; }')
document.write('#topgauche { position:absolute; z-index:10; }')
document.write('A:hover.ejsmenu {color:#000000; text-decoration:none;}')
document.write('A.ejsmenu {color:#000000; text-decoration:none;}')
document.write('</style>')
document.write('<div style="position:relative;height:25"><DIV class=popper id=topdeck></DIV>');
zlien = new Array;
zlien[0] = new Array;
zlien[1] = new Array;
zlien[2] = new Array;
zlien[3] = new Array;
zlien[0][0] = '<A HREF="a.html" CLASS=ejsmenu>Accueil</A>';
zlien[1][0] = '<A HREF="a.html" CLASS=ejsmenu>Championnat</A>';
zlien[1][1] = '<A HREF="a.html" CLASS=ejsmenu>Coupe de France</A>';
zlien[1][2] = '<A HREF="a.html" CLASS=ejsmenu>Open</A>';
zlien[2][0] = '<A HREF="a.html" CLASS=ejsmenu>En quelques mots</A>';
zlien[3][0] = '<A HREF="a.html" CLASS=ejsmenu>Exercice 1</A>';
zlien[3][1] = '<A HREF="a.html" CLASS=ejsmenu>Exercice 2</A>';
zlien[3][3] = '<A HREF="a.html" CLASS=ejsmenu>Exercice 3</A>';
var nava = (document.layers);
var dom = (document.getElementById);
var iex = (document.all);
if (nava) { skn = document.topdeck }
else if (dom) { skn = document.getElementById("topdeck").style }
else if (iex) { skn = topdeck.style }
skn.top = 24;
function pop(msg,pos)
{
skn.visibility = "hidden";
a=true
skn.left = pos;
var content ="<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 BGCOLOR=#000000 WIDTH=150><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=1>";
pass = 0
while (pass < msg.length)
{
content += "<TR><TD BGCOLOR="+bgcolor+" onMouseOver=\"this.style.background='"+bgcolor2+"'\" onMouseOut=\"this.style.background='"+bgcolor+"'\" HEIGHT=20><FONT SIZE=1 FACE=\"Verdana\"> "+msg[pass]+"</FONT></TD></TR>";
pass++;
}
content += "</TABLE></TD></TR></TABLE>";
if (nava)
{
skn.document.write(content);
skn.document.close();
skn.visibility = "visible";
}
else if (dom)
{
document.getElementById("topdeck").innerHTML = content;
skn.visibility = "visible";
}
else if (iex)
{
document.all("topdeck").innerHTML = content;
skn.visibility = "visible";
}
}
function kill()
{
skn.visibility = "hidden";
}
document.onclick = kill;
document.write('<DIV ID=topgauche><TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 BGCOLOR=#000000 WIDTH=400><TR><TD><TABLE CELLPADING=0 CELLSPACING=1 BORDER=0 WIDTH=100% HEIGHT=25><TR>')
document.write('<TD WIDTH=100 ALIGN=center BGCOLOR=\'#00ccff\' onMouseOver="this.style.background=\'#00ccff\';pop(zlien[0],0)" onMouseOut="this.style.background=\'#00ccff\'"><A onClick="return(false)" onMouseOver="pop(zlien[0],0)" href=# CLASS=ejsmenu><FONT SIZE=1 FACE="Verdana">Accueil</FONT></a></TD>')
document.write('<TD WIDTH=100 ALIGN=center BGCOLOR=\'#00cc00\' onMouseOver="this.style.background=\'#00cc00\';pop(zlien[1],100)" onMouseOut="this.style.background=\'#00cc00\'"><A onClick="return(false)" onMouseOver="pop(zlien[1],100)" href=# CLASS=ejsmenu><FONT SIZE=1 FACE="Verdana">Saison 07-08</FONT></a></TD>')
document.write('<TD WIDTH=100 ALIGN=center BGCOLOR=\'#ffcc00\' onMouseOver="this.style.background=\'#ffcc00\';pop(zlien[2],200)" onMouseOut="this.style.background=\'#ffcc00\'"><A onClick="return(false)" onMouseOver="pop(zlien[2],200)" href=# CLASS=ejsmenu><FONT SIZE=1 FACE="Verdana">L\'Association</FONT></a></TD>')
document.write('<TD WIDTH=100 ALIGN=center BGCOLOR=\'#ff3333\' onMouseOver="this.style.background=\'#ff3333\';pop(zlien[3],300)" onMouseOut="this.style.background=\'#ff3333\'"><A onClick="return(false)" onMouseOver="pop(zlien[3],300)" href=# CLASS=ejsmenu><FONT SIZE=1 FACE="Verdana">Exercices</FONT></a></TD>')
document.write('</TR></TABLE></TD></TR></TABLE></DIV></div>')
</script>
</body>
</html>
Tout fonctionne parfaitement dans ce script.
Vous verrez qu'au passage de la souris dans les sous-menus, la couleur de fond passe au blanc tandis la couleur de fond des sous-menus inactif restent gris.
Je voudrais juste que ces sous-menus inactifs aient la même couleur de fond que le titre correspondant :
Pour 'Accueil', je voudrais que les sous-menus inactifs soient bleus (#00ccff);
Pour 'Saison 07-08', je voudrais que les sous-menus inactifs soient verts (#00cc00);
Pour 'Association', je voudrais que les sous-menus inactifs soient orange (#ffcc00)...
Comment faire ?
Merci d'avance pour le coup de pouce.
liste des forums
liste des discussions
Participer à la discussion
Vous devez obligatoirement vous identifier en tant que membre pour participer à cette discussion.