11485 sujets

JavaScript, DOM et API Web HTML5

Bonjour,

Je viens de créer un menu en java script, un menu dynamique horizontale ou normalement chaque sous menu s'affiche sous la colonne choisi, sauf que tous mes menus s'affichent sur la colonne de gauche.

Que faire ?

ps : je suis débutante





Voici mon code java script :

bgcolor='#E0A232';
bgcolor2='#A9A7AA';
document.write('<style type="text/css">');
document.write('.popper { POSITION: absolute; VISIBILITY: hidden; z-index:4; }')
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>');


/*
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[0][0] = '<A HREF="http://www.google.fr" CLASS=ejsmenu>accueil</A>';
zlien[0][1] = '<A HREF="economiques.html" CLASS=ejsmenu>Economiques</A>';
zlien[0][2] = '<A HREF="malins.html" CLASS=ejsmenu>Malins</A>';
zlien[0][3] = '<A HREF="professionnels.html" CLASS=ejsmenu>Professionnels</A>';
zlien[0][4] = '<A HREF="gamers.html" CLASS=ejsmenu>Gamers</A>';
zlien[1][0] = '<A HREF="" CLASS=ejsmenu>kuku</A>';
zlien[1][1] = '<A HREF="ecrans.html" CLASS=ejsmenu>Ecrans</A>';
zlien[1][2] = '<A HREF="souris.html" CLASS=ejsmenu>Souris</A>';
zlien[1][3] = '<A HREF="claviers.html" CLASS=ejsmenu>Claviers</A>';
zlien[1][4] = '<A HREF="imprimantes.html" CLASS=ejsmenu>Imprimantes</A>';
zlien[1][5] = '<A HREF="tablettes.html" CLASS=ejsmenu>Tablettes graphique</A>';
zlien[1][6] = '<A HREF="enceintes.html" CLASS=ejsmenu>Enceintes Stéréo</A>';
zlien[1][7] = '<A HREF="disqued.html" CLASS=ejsmenu>Disque Dur</A>';
zlien[1][8] = '<A HREF="micro.html" CLASS=ejsmenu>Micro</A>';
zlien[1][9] = '<A HREF="webcam.html" CLASS=ejsmenu>Webcam</A>';
zlien[2][0] = '<A HREF="" CLASS=ejsmenu>kiki</A>';
zlien[3][0] = '<A HREF="" CLASS=ejsmenu>koko</A>';
zlien[4][0] = '<A HREF="http://www.fnac.fr" CLASS=ejsmenu>accueil</A>';
zlien[4][1] = '<A HREF="contact.html" CLASS=ejsmenu>Contactez-nous</A>';
zlien[4][2] = '<A HREF="sav.html" CLASS=ejsmenu>SAV</A>';
zlien[4][3] = '<A HREF="http://www.fnac.fr" CLASS=ejsmenu>Pourquoi Datic Informatique ?</A>';
zlien[4][4] = '<A HREF="mentionslegales.html" CLASS=ejsmenu>Mentions Légales</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=#ffffff WIDTH=150><TR><TD><TABLE WIDTH=400% 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=\"Arial\"><B>&nbsp;&nbsp;"+msg Smiley pass +"</B></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=#ffffff WIDTH=1000><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="Arial"><B>Ordinateurs</B></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="Arial"><B>Périphériques</B></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="Arial"><B>Occasions</B></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="Arial"><B>Commander</B></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="Arial"><B>A propose de nous</B></FONT></a></TD>')

document.write('</TR></TABLE></TD></TR></TABLE></DIV></div>')