Calendrier
Hors ligneGerets Le 16/08/2013 à 16:35 Profil de Gerets Configuration de Gerets

Bonjour,

 

Je cherche à m'informer pour installer un calendrier sur mon site internet : http://rrc-havelange.e-monsite.com/

 

J'aimerais placer un calendrier, et je me suis renseigné. Après quelques pages visitées, j'ai trouvé ce code sur votre forum. Je me demande désormais comment je pourrais placer des évènements sur les dates du calendrier, et si seulement c'est possible.

 

Par exemple, que je crééerais un évènement qui pourrait être trouvé sur cette page : http://rrc-havelange.e-monsite.com/agenda/

mais qui serait accessible directement et individuellement en fonction de la journée où cet évènement s'organisera. Je ne sais pas si je me fais bien comprendre.. En d'autres mots, que chaque journée où il y a un évènement ressorte bien du calendrier (peut-être en mettant la case dans une couleur différente, là encore j'ignore comment créer un tel code), et que lorsqu'on cliquerait sur une journée marquée d'un évènement, ce clic nous mènerait droit vers l'évènement/programme de la journée. Vous comprenez? :D

 

Je vous serais très reconnaissant si vous pouviez m'aider, ci dessous le code que j'a actuellement.

 

<script language="JavaScript">
 
/*
debut calendar
*/
 
var ns6=document.getElementById&&!document.all
var ie4=document.all
 
var Selected_Month;
var Selected_Year;
var Current_Date = new Date();
var Current_Month = Current_Date.getMonth();
 
var Days_in_Month = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
var Month_Label = new Array('Janvier', 'Fevrier', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Aout', 'Septembre', 'Octobre', 'Novembre', 'Decembre');
 
var Current_Year = Current_Date.getYear();
if (Current_Year < 1000)
Current_Year+=1900
 
 
var Today = Current_Date.getDate();
 
function Header(Year, Month) {
 
   if (Month == 1) {
   Days_in_Month[1] = ((Year % 400 == 0) || ((Year % 4 == 0) && (Year % 100 !=0))) ? 29 : 28;
   }
   var Header_String = Month_Label[Month] + ' ' + Year;
   return Header_String;
}
 
 
 
function Make_Calendar(Year, Month) {
   var First_Date = new Date(Year, Month, 1);
   var Heading = Header(Year, Month);
   var First_Day = First_Date.getDay() + 1;
   if (((Days_in_Month[Month] == 31) && (First_Day >= 6)) ||
       ((Days_in_Month[Month] == 30) && (First_Day == 7))) {
      var Rows = 6;
   }
   else if ((Days_in_Month[Month] == 28) && (First_Day == 1)) {
      var Rows = 4;
   }
   else {
      var Rows = 5;
   }
 
   var HTML_String = '<table><tr><td valign="top"><table BORDER=4 CELLSPACING=1 cellpadding=2 FRAME="box" BGCOLOR="C0C0C0" BORDERCOLORLIGHT="808080">';
 
   HTML_String += '<tr><th colspan=7 BGCOLOR="FFFFFF" BORDERCOLOR="000000">' + Heading + '</font></th></tr>';
 
   HTML_String += '<tr><th ALIGN="CENTER" BGCOLOR="FFFFFF" BORDERCOLOR="000000">-Dim</th><th ALIGN="CENTER" BGCOLOR="FFFFFF" BORDERCOLOR="000000">-Lun</th><th ALIGN="CENTER" BGCOLOR="FFFFFF" BORDERCOLOR="000000">-Mar</th><th ALIGN="CENTER" BGCOLOR="FFFFFF" BORDERCOLOR="000000">-Mer</th>';
 
   HTML_String += '<th ALIGN="CENTER" BGCOLOR="FFFFFF" BORDERCOLOR="000000">-Jeu</th><th ALIGN="CENTER" BGCOLOR="FFFFFF" BORDERCOLOR="000000">-Ven</th><th ALIGN="CENTER" BGCOLOR="FFFFFF" BORDERCOLOR="000000">-Sam </th></tr>';
 
   var Day_Counter = 1;
   var Loop_Counter = 1;
   for (var j = 1; j <= Rows; j++) {
      HTML_String += '<tr ALIGN="left" VALIGN="top">';
      for (var i = 1; i < 8; i++) {
         if ((Loop_Counter >= First_Day) && (Day_Counter <= Days_in_Month[Month])) {
            if ((Day_Counter == Today) && (Year == Current_Year) && (Month == Current_Month)) {
               HTML_String += '<td BGCOLOR="FFFFFF" BORDERCOLOR="000000"><strong><font color="red">' + Day_Counter + '</font></strong></td>';
            }
            else {
               HTML_String += '<td BGCOLOR="FFFFFF" BORDERCOLOR="000000">' + Day_Counter + '</td>';
            }
            Day_Counter++;    
         }
         else {
            HTML_String += '<td BORDERCOLOR="C0C0C0"> </td>';
         }
         Loop_Counter++;
      }
      HTML_String += '</tr>';
   }
   HTML_String += '</table></td></tr></table>';
   cross_el=ns6? document.getElementById("Calendar") : document.all.Calendar
   cross_el.innerHTML = HTML_String;
}
 
 
function Check_Nums() {
   if ((event.keyCode < 48) || (event.keyCode > 57)) {
      return false;
   }
}
 
 
 
function On_Year() {
   var Year = document.when.year.value;
   if (Year.length == 4) {
      Selected_Month = document.when.month.selectedIndex;
      Selected_Year = Year;
      Make_Calendar(Selected_Year, Selected_Month);
   }
}
 
function On_Month() {
   var Year = document.when.year.value;
   if (Year.length == 4) {
      Selected_Month = document.when.month.selectedIndex;
      Selected_Year = Year;
      Make_Calendar(Selected_Year, Selected_Month);
   }
   else {
      alert('Please enter a valid year.');
      document.when.year.focus();
   }
}
 
 
function Defaults() {
   if (!ie4&&!ns6)
   return
   var Mid_Screen = Math.round(document.body.clientWidth / 2);
   document.when.month.selectedIndex = Current_Month;
   document.when.year.value = Current_Year;
   Selected_Month = Current_Month;
   Selected_Year = Current_Year;
   Make_Calendar(Current_Year, Current_Month);
}
 
 
function Skip(Direction) {
   if (Direction == '+') {
      if (Selected_Month == 11) {
         Selected_Month = 0;
         Selected_Year++;
      }
      else {
         Selected_Month++;
      }
   }
   else {
      if (Selected_Month == 0) {
         Selected_Month = 11;
         Selected_Year--;
      }
      else {
         Selected_Month--;
      }
   }
   Make_Calendar(Selected_Year, Selected_Month);
   document.when.month.selectedIndex = Selected_Month;
   document.when.year.value = Selected_Year;
}
 
</script>
 
 
 
 
<div id=NavBar style="position:relative;width:100px;top:5px;" align="left">
<form name="when"><table width="50" height="38">
<tr>
   <td width="44">
   <input type="button" value="<" onClick="Skip('-')" style="width: 0.36in"></td>
   <p> </p>
   <td width="4"> </td>
   <td width="37">
   <select name="month" onChange="On_Month()" style="width: 109px">
 
<script language="JavaScript1.2">
if (ie4||ns6){
   for (j=0;j<Month_Label.length;j++) {
      document.writeln('<option value=' + j + '>' + Month_Label[j]);
   }
}
 
/*
Fin calendar
*/
 
 
</script>
 
       </select>
   </td>
   <td width="44">
   <input type="text" name="year" size=4 maxlength=4 onKeyPress="return Check_Nums()" onKeyUp="On_Year()" style="width: 0.44in"></td>
   <td width="4"> </td>
   <td width="44">
   <input type="button" value=">" onClick="Skip('+')" style="width: 0.36in"></td>
</tr></table></form></div>
<p>
</p>
<div id=Calendar style="position:relative;width:238px;top:-2px;" align="left"></div>
 
 
 
<body onLoad="Defaults()">                 
 
 
 

Vous avez résolu votre problème avec VIC ? Faites-le savoir sur les réseaux sociaux !
Vulgarisation-informatique.com
Cours en informatique & tutoriels