Code Javascript
Page mise à jour le 06-01-2026 à 23:21
<!-- bouton surgissant de retour vers le haut de page -->
<style>
a#cRetour {
    border-radius: 5px;
    padding: 8px 12px;
    font-size: 20px;
    text-align: center;
    color: #4169E1;
    background: #EEE;
    position: fixed;
    left: 50%;
    transform: translate(-510px);
    z-index: 5;
    transition: all ease-in 0.2s;
    opacity: 0.8;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    text-decoration: none;
}
a#cRetour:before {
    content: "\25B2";
}
a#cRetour:hover {
    background: #4169E1;
    color: #FFF;
    transition: all ease-in 0.2s;
    opacity: 1;
}
a#cRetour.cInvisible {
    bottom: -35px;
    opacity: 0;
    transition: all ease-in 0.5s;
}
a#cRetour.cVisible {
    bottom: 60px;
    opacity: 0.8;
}
</style>

<html>
    <div><a id="cRetour" class="cInvisible" href="#top"></a></div>
    <div id="top" style="position:absolute;top:-100px;"></div>
</html>

<script>
document.addEventListener('DOMContentLoaded', function() {
    window.onscroll = function(ev) {
        document.getElementById("cRetour").className = (window.pageYOffset > 100) ? "cVisible" : "cInvisible";
    };
});
</script>
// affichage de la date et de l'heure en temps réel
window.addEventListener('load',horloge);

function horloge() {
    var now = new Date();
    var year = now.getFullYear();
    var month = now.getMonth();
    var day = now.getDate();
    var hour = now.getHours();
    var minute = now.getMinutes();
    var second = now.getSeconds();

    document.getElementById('showDate').innerHTML = now.toLocaleDateString();
    document.getElementById('showTime').innerHTML = now.toLocaleTimeString();
    setTimeout(horloge, 1000);
}
<!-- horloge -->

<html>
<head>

<script type='text/javascript'>
    function refresh(){
        // rafraîchissement chaque seconde
        setTimeout('showDate()', 1000)
    }

    function showDate() {
        var date = new Date()
        var yy = date.getFullYear();
        var mm = date.getMonth() + 1;
        var dd = date.getDate();
        var j = date.getDay();
        var h = date.getHours();
        var m = date.getMinutes();
        var s = date.getSeconds();
        
        if( j == 0 ){ j = 'Dimanche'; }
        if( j == 1 ){ j = 'Lundi'; }
        if( j == 2 ){ j = 'Mardi'; }
        if( j == 3 ){ j = 'Mercredi'; }
        if( j == 4 ){ j = 'Jeudi'; }
        if( j == 5 ){ j = 'Vendredi'; }
        if( j == 6 ){ j = 'Samedi'; }
        
        // affichate type 1
        var time = j + '<br>' + dd + '/' + mm + '/' + yy + '<br>' + h + ':' + m + ':' + s
        document.getElementById('horloge').innerHTML = time;
        
        // affichate type 2
        document.getElementById('fullDay').innerHTML = j;
        document.getElementById('fullDate').innerHTML = date.toLocaleDateString();
        document.getElementById('fullTime').innerHTML = date.toLocaleTimeString();
        
        refresh();
    }
</script>

<style>
.horloge {
    background-color: #333;
    border-radius: 10px;
    width: 390px;
    height: 190px;
    margin-left: auto;
    margin-right: auto;
    font-family: verdana;
    font-weight: bold;
    font-size: 50px;
    color: #CCC;
    text-align: center;
    padding: 20px 20px;
}
.line {
    background-color: #333;
    width: 370px;
    height: 40px;
    margin-left: auto;
    margin-right: auto;
    font-family: verdana;
    font-weight: bold;
    font-size: 50px;
    color: #CCC;
    text-align: center;
    padding: 10px 20px 30px 20px;
}
.back {
    background-color: #333;
    border-radius: 10px;
    width: 430px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
    margin-top:20px;
}
</style>

</head>

<body onload='showDate();'>

<!-- affichate type 1 -->
<div id='horloge' class='horloge'></div>

<!-- affichate type 2 -->
<div class='back'>
    <div id='fullDay' class='line'></div>
    <div id='fullDate' class='line'></div>
    <div id='fullTime' class='line'></div>
</div>

</body>
</html>

// validation d'un champ avec la touche enter
// onKeyPress='listenEnter(event); return false;'
function listenEnter(event) {
    var keyCode = event.which ? event.which : event.keyCode;
    var key = String.fromCharCode(keyCode);
    var field = document.getElementById('');

    if (event.keyCode == 13){
        document.getElementById('button_connect').click();
        return false;
    } else field.value += key;
}

// limite la saisie aux caractères autorisés
// onKeyPress='alphaOnly(event); return false;'
function alphaOnly(event) {
    var keyCode = event.which ? event.which : event.keyCode;
    var key = String.fromCharCode(keyCode);
    var field = document.getElementById("");
    var chars = "abcdefghijklmnopqrstuvwxyz";
    chars += "àéèùâêîôûäëïöüç";
    chars += "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    chars += "0123456789";
    chars += "\'-. ";

    if (chars.indexOf(key) >= 0) field.value += key;
}
Papy WinTux - Philippe DESLOGES - 2023-2026 - Powered by Debian - Apache 2.4.54 - PHP 7.4.33 - Last update 06-01-2026 23:21 - Page size 31 ko built in 3 ms
All trademarks, logos, images and documents on these pages belong exclusively to their respective owners.