ICI header("Location: http://www.mytesting.fr ");

COMMENT INSTALLER UNE HORLOGE SUR VOTRE SITE

par André MARINI 26 Janvier 2018, 11:37 sites et blogs

CODE

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
   <head>
        <title></title>
        <meta name="content-language" content="fr">
        <meta name="robots" content="index,all">
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <link rel="stylesheet" media="screen" type="text/css" title="index" href="index.css" />
        <link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
   </head>
    
   <body>
<div id="date_heure">
<script type="text/javascript">
function compZero(nombre) {
    return nombre < 10 ? '0' + nombre : nombre;
}
 
function date_heure() {
    const infos = new Date();
 
    //Heure
    document.getElementById('date_heure').innerHTML = 'Il est ' + compZero(infos.getHours()) + ' heures ' + compZero(infos.getMinutes()) + ', ' + compZero(infos.getSeconds());
 
    //Date
    const mois = new Array('janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre');
    const jours = new Array('dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi');
    document.getElementById('date_heure').innerHTML += ' et nous sommes le ' + jours[infos.getDay()] + ' ' + infos.getDate() + ' ' + mois[infos.getMonth()] + ' ' + infos.getFullYear() + '.';
}
 
window.onload = function() {
   setInterval("date_heure()", 1000); //Actualisation de l'heure
};
</script>
</div>
</body>
</html>

RESULTAT

Haut de page