par
Kittie » 03 sept. 2008, 12:31
Bonjour,
j'ai réussi à comprendre le script et à bidouiller autour mais il y a un comportement que je n'arrive pas à corriger à savoir le premier clic et le changement de sens.
Le premier clic indique le sens à prendre "monter dans les mois" ou "descendre" mais il faut cliquer une 2ème fois pour qu'il se passe quelque chose. Idem quand on est en mai, que l'on descend en avril et qu'on veut remonter en mai il faut cliquer deux fois car le premier clic me fait redescendre en mars. Après une fois le sens rétabli, tout rentre dans l'ordre...
Ci-dessous mon code :
Code : Tout sélectionner
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Document sans titre</title>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_showHideLayers() { //v6.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
obj.visibility=v; }
}
//-->
</script>
</head>
<body>
<?php include ("connectik.php");
if ((isset($_POST["suiv"])) || (isset($_POST["prec"]))) {$magik1=$_POST["newmonth"];}else{$magik1=date("n");}
if ((isset($_POST["suiv"])) || (isset($_POST["prec"]))) {$magik2=$_POST["newyear"];}else{$magik2=date("Y");}
if ($magik1==13){$magik2=$_POST["newyear"]+1; $magik1=1;}
if ($magik1==0){$magik2=$_POST["newyear"]-1; $magik1=12;}
$magik3=date("w", mktime(0,0,0,$magik1,1,$magik2));
$magik4=date("t", mktime(0,0,0,$magik1,1,$magik2));
$magik6=date("d");
$magik1e=array("Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août", "Septembre","Octobre","Novembre","Décembre");
if ($magik3==0) {$magik3=7;}
echo "<table border=0 style='font-size:8pt;font-family:verdana,arial,tahoma'>\n
<th colspan=7 align=center>".$magik1e[$magik1-1]." ".$magik2."</th>
<tr>\n<td>Lu</td><td>Ma</td><td>Me</td><td>Je</td><td>Ve</td><td>Sa</td><td>Di</td></tr>\n<tr>\n";
$i=1; while ($i<$magik3) { echo "<td> </td>"; $i++; }
$i=1; while ($i<=$magik4) {
$magik5=($i+$magik3-1)%7;
echo"<td>";
$query = "SELECT * FROM events WHERE jour = '".$i."' AND mois = '".$magik1."' AND annee = '".$magik2."'";
$result = mysql_query($query);
$nb = mysql_num_rows($result);
if ($nb==0) { echo $i; }else{
while ($rows=mysql_fetch_array($result)){
echo '<div id="info'.$i.'" style="position:absolute; left:200px; top:50px; width:200px; height:100px; background-color: #FFFFCC; layer-background-color: #FFFFCC; border: 10px solid #000000; z-index:'.$i.'; visibility: hidden;">'.utf8_encode($rows["info"]).'</div>';
echo "<a href=\"#\" onMouseOver=\"MM_showHideLayers('info$i','','show')\" onMouseOut=\"MM_showHideLayers('info$i','','hidden')\" style='color:#ffffff; background-color:#00CCCC;font-size:8pt;font-family:verdana,arial,tahoma'>".$i."</a>";
}
}
echo "</td>\n";
if ($magik5==0) { echo "</tr>\n<tr>\n"; }
$i++;}
echo "</tr></td></table>\n";
echo '<p>';
$newmonth = $magik1;
if (!empty($_POST["suiv"])) {$newmonth = $magik1+1;}
if (!empty($_POST["prec"])) {$newmonth = $magik1-1;}
$newyear = $magik2;
?>
<form id="form1" name="form1" method="post" action="new_good.php">
<label>
<input type="submit" name="prec" value="prec" />
<input name="newmonth" type="text" id="newmonth" size="5" maxlength="5" value="<?php echo $newmonth; ?>"/>
<input name="newyear" type="text" id="newyear" size="5" maxlength="5" value="<?php echo $newyear; ?>"/>
</label>
<input type="submit" name="suiv" value="suiv" />
</form>
</p>
</body>
</html>
Si quelqu'un pouvait me donner un coup de pouce !
Je lui en serai reconnaissante merci
K.
Bonjour,
j'ai réussi à comprendre le script et à bidouiller autour mais il y a un comportement que je n'arrive pas à corriger à savoir le premier clic et le changement de sens.
Le premier clic indique le sens à prendre "monter dans les mois" ou "descendre" mais il faut cliquer une 2ème fois pour qu'il se passe quelque chose. Idem quand on est en mai, que l'on descend en avril et qu'on veut remonter en mai il faut cliquer deux fois car le premier clic me fait redescendre en mars. Après une fois le sens rétabli, tout rentre dans l'ordre...
Ci-dessous mon code :
[code]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Document sans titre</title>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_showHideLayers() { //v6.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
obj.visibility=v; }
}
//-->
</script>
</head>
<body>
<?php include ("connectik.php");
if ((isset($_POST["suiv"])) || (isset($_POST["prec"]))) {$magik1=$_POST["newmonth"];}else{$magik1=date("n");}
if ((isset($_POST["suiv"])) || (isset($_POST["prec"]))) {$magik2=$_POST["newyear"];}else{$magik2=date("Y");}
if ($magik1==13){$magik2=$_POST["newyear"]+1; $magik1=1;}
if ($magik1==0){$magik2=$_POST["newyear"]-1; $magik1=12;}
$magik3=date("w", mktime(0,0,0,$magik1,1,$magik2));
$magik4=date("t", mktime(0,0,0,$magik1,1,$magik2));
$magik6=date("d");
$magik1e=array("Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août", "Septembre","Octobre","Novembre","Décembre");
if ($magik3==0) {$magik3=7;}
echo "<table border=0 style='font-size:8pt;font-family:verdana,arial,tahoma'>\n
<th colspan=7 align=center>".$magik1e[$magik1-1]." ".$magik2."</th>
<tr>\n<td>Lu</td><td>Ma</td><td>Me</td><td>Je</td><td>Ve</td><td>Sa</td><td>Di</td></tr>\n<tr>\n";
$i=1; while ($i<$magik3) { echo "<td> </td>"; $i++; }
$i=1; while ($i<=$magik4) {
$magik5=($i+$magik3-1)%7;
echo"<td>";
$query = "SELECT * FROM events WHERE jour = '".$i."' AND mois = '".$magik1."' AND annee = '".$magik2."'";
$result = mysql_query($query);
$nb = mysql_num_rows($result);
if ($nb==0) { echo $i; }else{
while ($rows=mysql_fetch_array($result)){
echo '<div id="info'.$i.'" style="position:absolute; left:200px; top:50px; width:200px; height:100px; background-color: #FFFFCC; layer-background-color: #FFFFCC; border: 10px solid #000000; z-index:'.$i.'; visibility: hidden;">'.utf8_encode($rows["info"]).'</div>';
echo "<a href=\"#\" onMouseOver=\"MM_showHideLayers('info$i','','show')\" onMouseOut=\"MM_showHideLayers('info$i','','hidden')\" style='color:#ffffff; background-color:#00CCCC;font-size:8pt;font-family:verdana,arial,tahoma'>".$i."</a>";
}
}
echo "</td>\n";
if ($magik5==0) { echo "</tr>\n<tr>\n"; }
$i++;}
echo "</tr></td></table>\n";
echo '<p>';
$newmonth = $magik1;
if (!empty($_POST["suiv"])) {$newmonth = $magik1+1;}
if (!empty($_POST["prec"])) {$newmonth = $magik1-1;}
$newyear = $magik2;
?>
<form id="form1" name="form1" method="post" action="new_good.php">
<label>
<input type="submit" name="prec" value="prec" />
<input name="newmonth" type="text" id="newmonth" size="5" maxlength="5" value="<?php echo $newmonth; ?>"/>
<input name="newyear" type="text" id="newyear" size="5" maxlength="5" value="<?php echo $newyear; ?>"/>
</label>
<input type="submit" name="suiv" value="suiv" />
</form>
</p>
</body>
</html>[/code]
Si quelqu'un pouvait me donner un coup de pouce !
Je lui en serai reconnaissante merci
K.