1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
| function setStyle(id,style,value)
{
id.style[style] = value;
}
function opacite(el,opacity)
{
setStyle(el,"filter:","alpha(opacity="+opacity+")");
setStyle(el,"-moz-opacity",opacity/100);
setStyle(el,"-khtml-opacity",opacity/100);
setStyle(el,"opacity",opacity/100);
}
function calendrier()
{
var date = new Date();
var jour = date.getDate();
var moi = date.getMonth();
var annee = date.getYear();
if(annee<=200)
{
annee += 1900;
}
mois = new Array('Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre');
jours_dans_moi = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
if(annee%4 == 0 && annee!=1900)
{
jours_dans_moi[1]=29;
}
total = jours_dans_moi[moi];
var date_aujourdui = jour+' '+mois[moi]+' '+annee;
dep_j = date;
dep_j.setDate(1);
if(dep_j.getDate()==2)
{
dep_j=setDate(0);
}
dep_j = dep_j.getDay();
document.write('<table class="cal_calendrier" onload="opacite(document.getElementById(\'cal_body\'),20);"><tbody id="cal_body"><tr><th colspan="7">'+date_aujourdui+'</th></tr>');
document.write('<tr class="cal_j_semaines"><th>Dim</th><th>Lun</th><th>Mar</th><th>Mer</th><th>Jeu</th><th>Ven</th><th>Sam</th></tr><tr>');
sem = 0;
for(i=1;i<=dep_j;i++)
{
document.write('<td class="cal_jours_av_ap">'+(jours_dans_moi[moi-1]-dep_j+i)+'</td>');
sem++;
}
for(i=1;i<=total;i++)
{
if(sem==0)
{
document.write('<tr>');
}
if(jour==i)
{
document.write('<td class="cal_aujourdhui">'+i+'</td>');
}
else
{
document.write('<td>'+i+'</td>');
}
sem++;
if(sem==7)
{
document.write('</tr>');
sem=0;
}
}
for(i=1;sem!=0;i++)
{
document.write('<td class="cal_jours_av_ap">'+i+'</td>');
sem++;
if(sem==7)
{
document.write('</tr>');
sem=0;
}
}
document.write('</tbody></table>');
opacite(document.getElementById('cal_body'),70);
return true;
} |