La page s'affiche au premier plan
script js
//La première méthode d'affichage de l'heure actuelle du système
function showTime() {
var myArray = new Array(7);
var TD = new Date();
myArray[ 0] = "Dimanche";
myArray[1] = "Lundi";
myArray[2] = "Mardi";
myArray[3] = "Mercredi";
myArray[4 ] = "Jeudi";
myArray[5] = "Vendredi";
myArray[6] = "Samedi";
weekday = TD.getDay();
var h = TD.getHours ( );
var m = TD.getMinutes();
var s = TD.getSeconds();
var hstr = h;
var mstr = m;
var istr = s ;
if (h < 10) { hstr = "0" h };
if (m < 10) { mstr = "0" m };
if (s < 10) { istr = "0" s };
$("#clock").innerHTML('Heure actuelle :' new Date().toLocaleDateString() " " myArray[weekday] " " hstr ":" mstr ":" istr );
setTimeout(showTime, 1000);
}
//La deuxième méthode d'affichage de l'heure actuelle du système
function Clock() {
var date = new Date();
this.year=date.getFullYear();
this .month=date.getMonth() 1;
this.date=date.getDate();
this.day=newArray("Dimanche","Lundi","Mardi","Mercredi","Jeudi ","Vendredi","Samedi")[date.getDay()];
this.hour=date.getHours()<10?"0" date.getHours():date.getHours();
this.minute=date.getMinutes()<10?"0" date.getMinutes():date.getMinutes();
this.second=date.getSeconds()<10?"0" date .getSeconds():date.getSeconds();
this.toString=function(){
return "L'heure actuelle est :" this.year "Année" this.month "Mois" this.date "Day" this.hour ":" this.minute " : " cette.seconde "" ce.jour;
};
this.toSimpleDate=function(){
returnthis.year "-" this.month "-" this.date;
};
this.toDetailDate=function(){
returnthis.year "-" this.month "-" this.date "" this.hour ":" this.minute ":" this.second;
};
this.display=function(ele){
varclock=newClock();
ele.innerHTML=clock.toString();
window.setTimeout(function(){clock.display(ele );},1000);
};
}