|
Accueil > Javascripts >
Temps > Date du jour
Ce script affiche la date du jour
Vous placez le code suivant à
l'endroit où vous voulez afficher la date, entre les balises <body> et
</body>.
________________________________________________________________
<script
language="JavaScript">
Mois = new Date();
if (Mois.getMonth() == 0) {
NomMois = "Janvier";
}
if (Mois.getMonth() == 1) {
NomMois = "Fevrier";
}
if (Mois.getMonth() == 2) {
NomMois = "Mars";
}
if (Mois.getMonth() == 3) {
NomMois = "Avril";
}
if (Mois.getMonth() == 4) {
NomMois = "Mai";
}
if (Mois.getMonth() == 5) {
NomMois = "Juin";
}
if (Mois.getMonth() == 6) {
NomMois = "Juillet";
}
if (Mois.getMonth() == 7) {
NomMois = "Aout";
}
if (Mois.getMonth() == 8) {
NomMois = "Septembre";
}
if (Mois.getMonth() == 9) {
NomMois = "Octobre";
}
if (Mois.getMonth() == 10) {
NomMois = "Novembre";
}
if (Mois.getMonth() == 11) {
NomMois = "Décembre";
}
document.write
("Aujourd'hui, le "+ Mois.getDate() + " " + NomMois + "
"+Mois.getYear() );
</script>
________________________________________________________________
|