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
| <div>
<script>
function codecalendrier() {
function moiscompt(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11) {
this[0] = m0;
this[1] = m1;
this[2] = m2;
this[3] = m3;
this[4] = m4;
this[5] = m5;
this[6] = m6;
this[7] = m7;
this[8] = m8;
this[9] = m9;
this[10] = m10;
this[11] = m11;
}
function calendrie() {
var nommois = "JanFevMarAvrMaiJuiJulAutSepOctNovDec";
var jour = new Date();
var cejour;
var jourmois = new moiscompt(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
annee = jour.getYear();
if (annee <= 200) {
annee += 1900;
}
cejour = jour.getDate();
if (((annee % 4 == 0) && (annee % 100 != 0)) || (annee % 400 == 0)) {
jourmois[1] = 29;
}
njour = jourmois[jour.getMonth()];
premjour = jour;
premjour.setDate(1);
testmoi = premjour.getDate();
if (testmoi == 2) {
premjour.setDate(0);
}
debjour = premjour.getDay();
document.writeln("<CENTER>");
document.write("<TABLE BORDER='1' BGCOLOR=White>");
document.write("<TR><TH COLSPAN=7>");
document.write(annee);
document.write("<TR><TH COLSPAN=7>");
document.write(nommois.substring(jour.getMonth() * 3, (jour.getMonth() + 1) * 3));
document.write("<TR><TH>Lundi<TH>Mardi<TH>Mercredi<TH>Jeudi<TH>Vendredi<TH>Samedi<TH>Dimanche");
document.write("<TR>");
colonne = 0;
for (i = 0; i < debjour; i++) {
document.write("<TD>");
colonne++;
}
for (i = 1; i <= njour; i++) {
document.write("<TD>");
if (i == cejour) {
document.write("<FONT COLOR=\"#FF0000\">");
}
document.write(i);
if (i == cejour) {
document.write("</FONT>");
}
colonne++;
if (colonne == 7) {
document.write("<TR>");
colonne = 0;
}
}
document.write("</TABLE>");
document.writeln("</CENTER>");
}
calendrie();
}
codecalendrier();</script></div> |
Partager