Bonjour tout le monde,
Je m'y connais pas tellement en javascript, mais j'avais besoin d'un
menu pour mon site. J'ai trouvé une bonne source pour un jolie menu que
j'ai arrangé un peu, mais j'arrive pas à rajouter tout ce que je veux.
Pour le moment j'ai un menu déroulant lorsque l'on passe sur le "titre"
en haut. Et en fait, j'aimerai que dans ce menu il y aient encore des
sous-menu, mais je sais pas exactement comment faire, j'ai essayé une
fonction popInside(msg,pos), mais ça marche pas fort, j'ai besoin de
votre aide :)
Et un 2ème problème moins important, j'aimerai que la couleur du "titre" onMouseOver reste lorsque je suis dans le menu déroulé.
voilà la source :
<HTML>
<BODY>
<SCRIPT LANGUAGE="JavaScript">
bgcolor='#97041E' ;
bgcolor2='#F9B93E' ;
bgcolor3='#F9B93E' ;
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.menu {color:#FFFFFF; text-decoration:none;}')
document.write('A.menu {color:#FFFFFF; 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[4] = new Array ;
zlien[5] = new Array ;
zlien[11] = new Array ;
zlien[1][0] = '<A HREF="" CLASS=menu>Championnat</A>' ;
zlien[1][1] = '<A HREF="" CLASS=menu>Tournoi</A>' ;
zlien[1][2] = '<A HREF="" CLASS=menu>Coupe</A>' ;
zlien[11][0] =
'<A HREF="" CLASS=menu>prévues</A>' ;
zlien[11][1] = '<A HREF="" CLASS=menu>en cours</A>' ;
zlien[11][2] =
'<A HREF="" CLASS=menu>terminées</A>' ;
zlien[11][3] =
'<A HREF="" CLASS=menu>TM prévues</A>' ;
zlien[11][4] = '<A HREF="" CLASS=menu>TM en cours</A>' ;
zlien[11][5] =
'<A HREF="" CLASS=menu>TM terminées</A>' ;
zlien[2][0] = '<A HREF="" CLASS=menu>Membre</A>' ;
zlien[2][1] = '<A HREF="" CLASS=menu>Equipe</A>' ;
zlien[2][2] =
'<A HREF="" CLASS=menu>Compétition</A>' ;
zlien[3][0] = '<A HREF="" CLASS=menu>Forum</A>' ;
zlien[3][1] =
'<A HREF="" CLASS=menu>Trucs & Astuces</A>' ;
zlien[3][2] = '<A HREF="" CLASS=menu>Dossiers</A>' ;
zlien[3][3] = '<A HREF="" CLASS=menu>Liens</A>' ;
zlien[3][4] =
'<A HREF=""
CLASS=menu>Téléchargements</A>' ;
zlien[4][0] = '<A HREF="" CLASS=menu>Staff</A>' ;
zlien[4][1] = '<A HREF="" CLASS=menu>Sponsors</A>' ;
zlien[4][2] = '<A HREF="" CLASS=menu>A propos</A>' ;
zlien[5][0] = '<A HREF="" CLASS=menu>Info</A>' ;
zlien[5][1] =
'<A HREF="" CLASS=menu>Créer une
équipe</A>' ;
zlien[5][2] =
'<A HREF="" CLASS=menu>Rejoindre une équipe</A>'
;
zlien[5][3] =
'<A HREF="" CLASS=menu>Créer une
équipe</A>' ;
zlien[5][4] =
'<A HREF="" CLASS=menu>Créer une
compétition</A>' ;
zlien[5][5] =
'<A HREF="" CLASS=menu>Gérer mes
compétitions</A>' ;
zlien[5][6] =
'<A HREF="" CLASS=menu>Déconnexion</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 = 19 ;
document.onclick = kill ;
document.write('<DIV ID=topgauche><TABLE BORDER=0
CELLPADDING=0 CELLSPACING=0 BGCOLOR=#000000
WIDTH=800><TR><TD><TABLE CELLPADING=0 CELLSPACING=1
BORDER=0 WIDTH=100% HEIGHT=20><TR>')
document.write('<TD WIDTH=133 ALIGN=center BGCOLOR='+bgcolor+'
onMouseOver="this.style.background=\''+bgcolor3+'\';pop(zlien[0],0)"
onMouseOut="this.style.background=\''+bgcolor+'\'"><A
onClick="return(false)" href=# CLASS=menu><FONT SIZE=1
FACE="Verdana"><B>Accueil</B></FONT></a></TD>')
document.write('<TD WIDTH=133 ALIGN=center BGCOLOR='+bgcolor+'
onMouseOver="this.style.background=\''+bgcolor3+'\';pop(zlien[1],133)"
onMouseOut="this.style.background=\''+bgcolor+'\'"><A
onClick="return(false)" href=# CLASS=menu><FONT SIZE=1
FACE="Verdana"><B>Compétitions</B></FONT></a></TD>')
document.write('<TD WIDTH=133 ALIGN=center BGCOLOR='+bgcolor+'
onMouseOver="this.style.background=\''+bgcolor3+'\';pop(zlien[2],266)"
onMouseOut="this.style.background=\''+bgcolor+'\'"><A
onClick="return(false)" href=# CLASS=menu><FONT SIZE=1
FACE="Verdana"><B>Recherche</B></FONT></a></TD>')
document.write('<TD WIDTH=133 ALIGN=center BGCOLOR='+bgcolor+'
onMouseOver="this.style.background=\''+bgcolor3+'\';pop(zlien[3],399)"
onMouseOut="this.style.background=\''+bgcolor+'\'"><A
onClick="return(false)" href=# CLASS=menu><FONT SIZE=1
FACE="Verdana"><B>Services</B></FONT></a></TD>')
document.write('<TD WIDTH=133 ALIGN=center BGCOLOR='+bgcolor+'
onMouseOver="this.style.background=\''+bgcolor3+'\';pop(zlien[4],532)"
onMouseOut="this.style.background=\''+bgcolor+'\'"><A
onClick="return(false)" href=# CLASS=menu><FONT SIZE=1
FACE="Verdana"><B>Informations</B></FONT></a></TD>')
document.write('<TD WIDTH=133 ALIGN=center BGCOLOR='+bgcolor+'
onMouseOver="this.style.background=\''+bgcolor3+'\';pop(zlien[5],665)"
onMouseOut="this.style.background=\''+bgcolor+'\'"><A
onClick="return(false)" href=# CLASS=menu><FONT SIZE=1
FACE="Verdana"><B>Mon
compte</B></FONT></a></TD>')
document.write('</TR></TABLE></TD></TR></TABLE></DIV></div>')
function pop(msg,pos)
{
skn.visibility = "hidden" ;
a=true
skn.left = pos ;
var content ="<TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0 BGCOLOR=#000000
WIDTH=133><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=15><FONT SIZE=1
FACE=\"Verdana\"><B> "+msg[pass]+"</B></FONT></TD></TR>"
;
if (msg == zlien[1])
{
popInside(zlien[11], pos+133)
}
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 popInside(msg,pos)
{
skn.visibility = "hidden" ;
a=true
skn.left = pos ;
var content2 ="<TABLE BORDER=0 CELLPADDING=0
CELLSPACING=0 BGCOLOR=#000000
WIDTH=133><TR><TD><TABLE WIDTH=100% BORDER=0
CELLPADDING=0 CELLSPACING=1>" ;
pass2 = 0
while (pass2 < msg.length)
{
content2 +=
"<TR><TD BGCOLOR="+bgcolor+"
onMouseOver=\"this.style.background='"+bgcolor2+"'\"
onMouseOut=\"this.style.background='"+bgcolor+"'\"
HEIGHT=15><FONT SIZE=1
FACE=\"Verdana\"><B> "+msg[pass2]+"</B></FONT></TD></TR>"
;
pass2++ ;
}
content2 +=
"</TABLE></TD></TR></TABLE>" ;
if (nava)
{
skn.document.write(content2) ;
skn.document.close() ;
skn.visibility = "visible" ;
}
else if (dom)
{
document.getElementById("topdeck").innerHTML = content2 ;
skn.visibility = "visible" ;
}
else if (iex)
{
document.all("topdeck").innerHTML
= content2 ;
skn.visibility = "visible" ;
}
}
function kill()
{
skn.visibility = "hidden" ;
}
</SCRIPT>
</BODY>
</HTML>