Centrer un menu déroulant

Résolu
judith1706 Messages postés 18 Date d'inscription lundi 3 juin 2013 Statut Membre Dernière intervention 27 janvier 2021 - Modifié par jordane45 le 4/04/2014 à 23:33
judith1706 Messages postés 18 Date d'inscription lundi 3 juin 2013 Statut Membre Dernière intervention 27 janvier 2021 - 5 avril 2014 à 23:13
Bonsoir,

Je me suis aidé d'Internet pour faire mon menu déroulant. Il fonctionne à merveille! Parfait! Le problème maintenant est que j'aimerai le centrer. Et là, j'ai beau parcourir tous les sites possible, essayer une multitude de code, je n'y arrive pas. J'utilise le logiciel NVU pour faire mon site Internet: un logiciel complexe.

Ci dessous le code source de mon menu défilant:
bgcolor='##3366FF'; 
bgcolor2='#FFCC00'; 
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:#FFFFFF; text-decoration:none;}') 
document.write('A.ejsmenu {color:#FFFFFF; text-decoration:none;}') 
document.write('</style>') 
document.write('<div style="position:relative;height:25"><DIV class=popper id=topdeck></DIV>'); 
/* 
SCRIPT EDITE SUR L'EDITEUR JAVACSRIPT 
[http://www.editeurjavascript.com] 
*/ 

/* 
LIENS 
*/ 
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[1][0] = '<A HREF="file:///E:/Site%20Internet/Page%202%20(Le%20club)/Historique.html" CLASS=ejsmenu>Historique</A>'; 
zlien[1][1] = '<A HREF="file:///E:/Site%20Internet/Page%202%20(Le%20club)/Organigramme.html" CLASS=ejsmenu>Organigramme</A>'; 
zlien[1][2] = '<A HREF="file:///E:/Site%20Internet/Page%202%20(Le%20club)/Ou%20nous%20trouver.html" CLASS=ejsmenu>Ou nous trouver</A>'; 
zlien[1][3] = '<A HREF="file:///E:/Site%20Internet/Page%202%20(Le%20club)/Nous%20contacter.html" CLASS=ejsmenu>Nous contacter</A>'; 
zlien[1][4] = '<A HREF="file:///E:/Site%20Internet/Page%202%20(Le%20club)/Nos%20partenaires.html" CLASS=ejsmenu>Nos partenaires</A>'; 
zlien[2][0] = '<A HREF=" file:///E:/Site%20Internet/Page%203%20(Les%20cours)/Les%20horaires.html" CLASS=ejsmenu>Les horaires</A>'; 
zlien[2][1] = '<A HREF="file:///E:/Site%20Internet/Page%203%20(Les%20cours)/Les%20tarifs.html" CLASS=ejsmenu>Les tarifs</A>'; 
zlien[2][2] = '<A HREF="file:///E:/Site%20Internet/Page%203%20(Les%20cours)/Les%20professeurs.html" CLASS=ejsmenu>Les professeurs</A>'; 
zlien[3][0] = '<A HREF="file:///E:/Site%20Internet/Page%204%20(Actualit%E9s)/Calendrier.html" CLASS=ejsmenu>Calendrier</A>'; 
zlien[3][1] = '<A HREF="file:///E:/Site%20Internet/Page%204%20(Actualit%E9s)/Evenements.html" CLASS=ejsmenu>Evénements </A>'; 
zlien[3][2] = '<A HREF="file:///E:/Site%20Internet/Page%204%20(Actualit%E9s)/R%E9sultats.htm" CLASS=ejsmenu>Résultats</A>'; 
zlien[4][0] = '<A HREF="file:///E:/Site%20Internet/Page%205%20(Disciplines)/Judo.html" CLASS=ejsmenu>Judo</A>'; 
zlien[4][1] = '<A HREF="file:///E:/Site%20Internet/Page%205%20(Disciplines)/Ta%EFso.html" CLASS=ejsmenu>Taïso</A>'; 
zlien[4][2] = '<A HREF="file:///E:/Site%20Internet/Page%205%20(Disciplines)/Self-d%E9fense.html" CLASS=ejsmenu>Self-défense</A>'; 
zlien[5][0] = '<A HREF="file:///E:/Site%20Internet/Page%206%20(Galeries)/Photos.html" CLASS=ejsmenu>Photos</A>'; 
zlien[5][1] = '<A HREF="file:///E:/Site%20Internet/Page%206%20(Galeries)/Vid%E9os.html" CLASS=ejsmenu>Vidéos</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=600><TR><TD><TABLE CELLPADING=0 CELLSPACING=1 BORDER=0 WIDTH=100% HEIGHT=25><TR>') 
document.write('<TD WIDTH=100 ALIGN=center BGCOLOR='+bgcolor+' onMouseOver="this.style.background=\''+bgcolor2+'\';pop(zlien[0],0)" onMouseOut="this.style.background=\''+bgcolor+'\'"><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='+bgcolor+' onMouseOver="this.style.background=\''+bgcolor2+'\';pop(zlien[1],100)" onMouseOut="this.style.background=\''+bgcolor+'\'"><A onClick="return(false)" onMouseOver="pop(zlien[1],100)" href=# CLASS=ejsmenu><FONT SIZE=1 FACE="Verdana">Le club</FONT></a></TD>') 
document.write('<TD WIDTH=100 ALIGN=center BGCOLOR='+bgcolor+' onMouseOver="this.style.background=\''+bgcolor2+'\';pop(zlien[2],200)" onMouseOut="this.style.background=\''+bgcolor+'\'"><A onClick="return(false)" onMouseOver="pop(zlien[2],200)" href=# CLASS=ejsmenu><FONT SIZE=1 FACE="Verdana">Les cours</FONT></a></TD>') 
document.write('<TD WIDTH=100 ALIGN=center BGCOLOR='+bgcolor+' onMouseOver="this.style.background=\''+bgcolor2+'\';pop(zlien[3],300)" onMouseOut="this.style.background=\''+bgcolor+'\'"><A onClick="return(false)" onMouseOver="pop(zlien[3],300)" href=# CLASS=ejsmenu><FONT SIZE=1 FACE="Verdana">Actualités</FONT></a></TD>') 
document.write('<TD WIDTH=100 ALIGN=center BGCOLOR='+bgcolor+' onMouseOver="this.style.background=\''+bgcolor2+'\';pop(zlien[4],400)" onMouseOut="this.style.background=\''+bgcolor+'\'"><A onClick="return(false)" onMouseOver="pop(zlien[4],400)" href=# CLASS=ejsmenu><FONT SIZE=1 FACE="Verdana">Disciplines</FONT></a></TD>') 
document.write('<TD WIDTH=100 ALIGN=center BGCOLOR='+bgcolor+' onMouseOver="this.style.background=\''+bgcolor2+'\';pop(zlien[5],500)" onMouseOut="this.style.background=\''+bgcolor+'\'"><A onClick="return(false)" onMouseOver="pop(zlien[5],500)" href=# CLASS=ejsmenu><FONT SIZE=1 FACE="Verdana">Galeries</FONT></a></TD>') 
document.write('</TR></TABLE></TD></TR></TABLE></DIV></div>') 




C'est surement quelques chose de tout bête, mais là, je sèche.. Que dois-je modifier, ou rajouter, et ou?

Merci d'avance,

Amicalement,

Judith1706

2 réponses

@karamel Messages postés 1855 Date d'inscription vendredi 9 mai 2008 Statut Modérateur Dernière intervention 18 avril 2024 153
Modifié par kazma le 5/04/2014 à 12:48
c'est un tres vieux code il y a du code inutile sans parlé de l'utilisation de document.write qui est a proscrire

essai comme ca

<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />


<script>


bgcolor='#3366FF'; 
bgcolor2='#FFCC00'; 
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:#FFFFFF; text-decoration:none;}') 
document.write('A.ejsmenu {color:#FFFFFF; text-decoration:none;}') 
document.write('</style>') 
document.write('<div style="position:relative;height:25px;width:600px;margin:auto"><DIV class=popper id=topdeck></DIV>'); 
/* 
SCRIPT EDITE SUR L'EDITEUR JAVACSRIPT 
[http://www.editeurjavascript.com] 
*/ 

/* 
LIENS 
*/ 
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[1][0] = '<A HREF="file:///E:/Site%20Internet/Page%202%20(Le%20club)/Historique.html" CLASS=ejsmenu>Historique</A>'; 
zlien[1][1] = '<A HREF="file:///E:/Site%20Internet/Page%202%20(Le%20club)/Organigramme.html" CLASS=ejsmenu>Organigramme</A>'; 
zlien[1][2] = '<A HREF="file:///E:/Site%20Internet/Page%202%20(Le%20club)/Ou%20nous%20trouver.html" CLASS=ejsmenu>Ou nous trouver</A>'; 
zlien[1][3] = '<A HREF="file:///E:/Site%20Internet/Page%202%20(Le%20club)/Nous%20contacter.html" CLASS=ejsmenu>Nous contacter</A>'; 
zlien[1][4] = '<A HREF="file:///E:/Site%20Internet/Page%202%20(Le%20club)/Nos%20partenaires.html" CLASS=ejsmenu>Nos partenaires</A>'; 
zlien[2][0] = '<A HREF=" file:///E:/Site%20Internet/Page%203%20(Les%20cours)/Les%20horaires.html" CLASS=ejsmenu>Les horaires</A>'; 
zlien[2][1] = '<A HREF="file:///E:/Site%20Internet/Page%203%20(Les%20cours)/Les%20tarifs.html" CLASS=ejsmenu>Les tarifs</A>'; 
zlien[2][2] = '<A HREF="file:///E:/Site%20Internet/Page%203%20(Les%20cours)/Les%20professeurs.html" CLASS=ejsmenu>Les professeurs</A>'; 
zlien[3][0] = '<A HREF="file:///E:/Site%20Internet/Page%204%20(Actualit%E9s)/Calendrier.html" CLASS=ejsmenu>Calendrier</A>'; 
zlien[3][1] = '<A HREF="file:///E:/Site%20Internet/Page%204%20(Actualit%E9s)/Evenements.html" CLASS=ejsmenu>Evénements </A>'; 
zlien[3][2] = '<A HREF="file:///E:/Site%20Internet/Page%204%20(Actualit%E9s)/R%E9sultats.htm" CLASS=ejsmenu>Résultats</A>'; 
zlien[4][0] = '<A HREF="file:///E:/Site%20Internet/Page%205%20(Disciplines)/Judo.html" CLASS=ejsmenu>Judo</A>'; 
zlien[4][1] = '<A HREF="file:///E:/Site%20Internet/Page%205%20(Disciplines)/Ta%EFso.html" CLASS=ejsmenu>Taïso</A>'; 
zlien[4][2] = '<A HREF="file:///E:/Site%20Internet/Page%205%20(Disciplines)/Self-d%E9fense.html" CLASS=ejsmenu>Self-défense</A>'; 
zlien[5][0] = '<A HREF="file:///E:/Site%20Internet/Page%206%20(Galeries)/Photos.html" CLASS=ejsmenu>Photos</A>'; 
zlien[5][1] = '<A HREF="file:///E:/Site%20Internet/Page%206%20(Galeries)/Vid%E9os.html" CLASS=ejsmenu>Vidéos</A>'; 

 skn = document.getElementById("topdeck").style 

skn.top = 24+'px'; 

function pop(msg,pos) { 
skn.visibility = "hidden"; 
a=true 
skn.left = pos+'px'; 
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>"; 

document.getElementById("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=600><TR><TD><TABLE CELLPADING=0 CELLSPACING=1 BORDER=0 WIDTH=100% HEIGHT=25><TR>') 
document.write('<TD WIDTH=100 ALIGN=center BGCOLOR='+bgcolor+' onMouseOver="this.style.background=\''+bgcolor2+'\';pop(zlien[0],0)" onMouseOut="this.style.background=\''+bgcolor+'\'"><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='+bgcolor+' onMouseOver="this.style.background=\''+bgcolor2+'\';pop(zlien[1],100)" onMouseOut="this.style.background=\''+bgcolor+'\'"><A onClick="return(false)" onMouseOver="pop(zlien[1],100)" href=# CLASS=ejsmenu><FONT SIZE=1 FACE="Verdana">Le club</FONT></a></TD>') 
document.write('<TD WIDTH=100 ALIGN=center BGCOLOR='+bgcolor+' onMouseOver="this.style.background=\''+bgcolor2+'\';pop(zlien[2],200)" onMouseOut="this.style.background=\''+bgcolor+'\'"><A onClick="return(false)" onMouseOver="pop(zlien[2],200)" href=# CLASS=ejsmenu><FONT SIZE=1 FACE="Verdana">Les cours</FONT></a></TD>') 
document.write('<TD WIDTH=100 ALIGN=center BGCOLOR='+bgcolor+' onMouseOver="this.style.background=\''+bgcolor2+'\';pop(zlien[3],300)" onMouseOut="this.style.background=\''+bgcolor+'\'"><A onClick="return(false)" onMouseOver="pop(zlien[3],300)" href=# CLASS=ejsmenu><FONT SIZE=1 FACE="Verdana">Actualités</FONT></a></TD>') 
document.write('<TD WIDTH=100 ALIGN=center BGCOLOR='+bgcolor+' onMouseOver="this.style.background=\''+bgcolor2+'\';pop(zlien[4],400)" onMouseOut="this.style.background=\''+bgcolor+'\'"><A onClick="return(false)" onMouseOver="pop(zlien[4],400)" href=# CLASS=ejsmenu><FONT SIZE=1 FACE="Verdana">Disciplines</FONT></a></TD>') 
document.write('<TD WIDTH=100 ALIGN=center BGCOLOR='+bgcolor+' onMouseOver="this.style.background=\''+bgcolor2+'\';pop(zlien[5],500)" onMouseOut="this.style.background=\''+bgcolor+'\'"><A onClick="return(false)" onMouseOver="pop(zlien[5],500)" href=# CLASS=ejsmenu><FONT SIZE=1 FACE="Verdana">Galeries</FONT></a></TD>') 
document.write('</TR></TABLE></TD></TR></TABLE></DIV></div>')

</script>
</head>
<body>
</body>
</html>


cours Forest cours !
0
judith1706 Messages postés 18 Date d'inscription lundi 3 juin 2013 Statut Membre Dernière intervention 27 janvier 2021
5 avril 2014 à 23:13
Bonsoir kazma,

Merci bien pour ta réponse si rapide. Vu que tu me dis que c'est un vieux code avec beaucoup de chose inutile et vu que je n'arrivais pas à faire ce que tu me disais j'ai fais un second menu déroulant avec un autre code différent du premier qui lui fonctionne et est plus simple.

Amicalement,

Judith
0
Rejoignez-nous