Forum de discussion
Forum « Programmation Javascript » (archives)
Menu dynamique
Envoyé: 26 mars 2004, 4h22 par davee
Ci dessous un code de menu dynamique
Il y a 2 tableaux l'un ss l'autre
Le menu dynamique du 2ème tableau marche très bien , par contre le menu dynamique du tableau ds document.write ne marche pas.
Comment faire ?
Merci d'avance
david
<html>
<body>
<style>
body {font-family: Comic Sans MS, , sans-serif;padding: 0; margin: 2;
font-size: 2pt; background-color: #646464; color:#00599b}
h1 {text-align: center; font-weight:bold; color: #00599b; margin:0; padding: 0;
font-size: 2pt;}
p {color:#000000; font-size: 2pt; padding: 2; margin: 0}
#lev1 {font-size: 2pt; margin-left: 10}
</style>
<body bgcolor="#646464" link="#00FF00" vlink="#FFFF00" alink="FFFF00" >
<script language="javascript">
/*
Script téléchargé sur EasyScript (www.easy-script.com)
JAVASCRIPT CREE SUR
ESPACE JAVASCRIPT.COM
http://www.espacejavascript.com
*/
total = 2;
// Entrez ci-dessus le nombre de sous-menus
control = total+1;
function cache(n)
{
document.getElementById(n).style.visibility = 'hidden';
}
function montre(n)
{
document.getElementById(n).style.visibility = 'visible';
document.getElementById(n).style.left = event.clientX + document.body.scrollLeft;
document.getElementById(n).style.top = event.clientY + document.body.scrollTop;
}
function controle(n)
{
for(i = 1; i < control; i++)
{
if((document.getElementById(i).style.visibility = 'visible')&&(i != n))
{
document.getElementById(i).style.visibility = 'hidden';
}
}
}
</script>
<DIV ID="1" STYLE="position:absolute;visibility:hidden" onmouseout="cache(1)">
<table width=60 bgcolor="#00CCFF" cellpadding=0 cellspacing=1>
<tr><td bgcolor="#00CCFF" STYLE="padding:4" onmouseover="document.getElementById(1).style.visibility = 'visible';controle(1)">
<font face="verdana" size=1 color="#ffffff"><b>
<a href=""target="principale" STYLE="color:#ffffff">Nébulosité</a><br>
<a href=""target="principale" STYLE="color:#ffffff">Front</a><br>
<a href=""target="principale" STYLE="color:#ffffff">Pluie</a><br>
<a href=""target="principale" STYLE="color:#ffffff">Vent</a><br>
<a href="" target="principale"STYLE="color:#ffffff">Slp générale</a><br>
<a href="" target="principale"STYLE="color:#ffffff">Slp france</a><br>
<a href="" target="principale"STYLE="color:#ffffff">Observations</a><br>
</td></tr></table>
</DIV>
<DIV ID="2" STYLE="position:absolute;visibility:hidden" onmouseout="cache(2)">
<table width=60 bgcolor="#33CCFF" cellpadding=0 cellspacing=1>
<tr><td bgcolor="#33CCFF" STYLE="padding:4" onmouseover="document.getElementById(2).style.visibility = 'visible';controle(2)">
<font face="verdana" size=1 color="#ffffff"><b>
<a href=""target="principale" STYLE="color:#ffffff"><b>Nébulosité</b></a><br>
<a href=""target="principale" STYLE="color:#ffffff"><b>Fronts</b></a><br>
<a href=""target="principale" STYLE="color:#ffffff"><b>Pluie</b></a><br>
</td></tr></table>
</DIV>
<script type="Text/JavaScript">
//~~~~~~~~~~~~~~~~~~~~~~~
function LibJour(jj,mm,aa) //~~ Libellé d'un jour ~~
//~~~~~~~~~~~~~~~~~~~~~~~
{ var J=new Array("Lundi","Mardi","Mercredi","Jeudi",
"Vendredi","Samedi","Dimanche");
var M=new Array("Janvier","Février","Mars",
"Avril","Mai","Juin",
"Juillet","Août","Septembre",
"Octobre","Novembre","Décembre");
var C1, C2, Ret, vA, vM, vJ;
vA = aa;
vM = mm;
vJ = jj;
if (vM <= 2)
{ vM = vM + 12;
vA = vA - 1; }
C1 = (vJ - 1)
+ Math.floor((Math.floor(vA * 5)) / 4)
- Math.floor(vA / 100)
+ Math.floor(vA / 400)
+ Math.floor(((vM + 1) * 13) / 5);
C2 = (Math.floor(C1 / 7) * 7);
C1 = C1 - C2;
if (C1 < 1) C1 = 7;
Ret = J[C1-1] + " " + jj;
if (jj==1) Ret=Ret+"er";
Ret = Ret +
" " + M[mm-1] +
" " + aa;
return Ret; }
</script>
</HEAD>
<BODY>
<script type="Text/JavaScript">
var d=new Date();
var r=LibJour(d.getDate(),d.getMonth()+1,d.getYear());
var r1=LibJour(d.getDate()+1,d.getMonth()+1,d.getYear());
var r2=LibJour(d.getDate()+2,d.getMonth()+1,d.getYear());
document.write("<table width='170' cellpadding=2 border=1 bordercolor='#FFFFFF' bgcolor='#FFFFFF' cellspacing=10 bordercolorlight='#646464' bordercolordark='#646464'><tr><td width=130 STYLE='cursor:hand;color:#FFFFFF;background-color:#646464' onmouseout='this.style.background='#646464'' onmouseover='this.style.background='#4B4B4B';montre(1);controle(1)'><font face=Times New Roman size=3><b>"+r+"</b></font></td></a></TR><tr><td width=130 STYLE='cursor:hand;color:#FFFFFF;background-color:#646464' onmouseout='this.style.background='#646464'' onmouseover='this.style.background='#4B4B4B';montre(1);controle(1)'><font face=Times New Roman size=3><b>"+r1+"</b></font></td></TR>");
</script>
<table width="170" cellpadding=2 border=1 bordercolor="#FFFFFF" bgcolor="#FFFFFF" cellspacing=10 bordercolorlight="#646464" bordercolordark="#646464">
<tr>
<td width=130 STYLE="cursor:hand;color:#FFFFFF;background-color:#646464" onmouseout="this.style.background='#646464'" onmouseover="this.style.background='#4B4B4B';montre(1);controle(1)"><font face=Times New Roman size=3><b>Analyse</b></font></td></a>
</tr><tr>
<td width=130 STYLE="cursor:hand;color:#FFFFFF;background-color:#646464" onmouseout="this.style.background='#646464'" onmouseover="this.style.background='#4B4B4B';montre(2);controle(2)"><font face=Times New Roman size=3><b>Prévi aujourd'hui</b></font></td></a>
</tr>
</table>
</body>
</html>
Réponses
|