• 12-11-2023, 15:52:52
    #1
    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Simple Clock</title>
    <style>
    body {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    margin: 0;
    background-color: #f0f0f0;
    font-family: 'Arial', sans-serif;
    }
    #clock {
    font-size: 3em;
    }
    </style>
    </head>
    <body>
    <div id="clock"></div>
    <script>
    function updateClock() {
    const now = new Date();
    const hours = now.getHours().toString().padStart(2, '0');
    const minutes = now.getMinutes().toString().padStart(2, '0');
    const seconds = now.getSeconds().toString().padStart(2, '0');
    const timeString = `${hours}:${minutes}:${seconds}`;
    document.getElementById('clock').innerText = timeString;
    }

    setInterval(updateClock, 1000);
    updateClock(); // Sayfa yüklendiğinde saati hemen göstermek için

    </script>
    </body>
    </html>
    • ibocum
    ibocum bunu beğendi.
    1 kişi bunu beğendi.
  • 12-11-2023, 16:01:01
    #2
    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Simple Clock</title>
    <style>
    body {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    margin: 0;
    background-color: #f0f0f0;
    font-family: 'Arial', sans-serif;
    }
    #clock {
    font-size: 3em;
    }
    </style>
    </head>
    <body>
    <div id="clock"></div>
    <script>
    function updateClock() {
    const now = new Date();
    const hours = now.getHours().toString().padStart(2, '0');
    const minutes = now.getMinutes().toString().padStart(2, '0');
    const seconds = now.getSeconds().toString().padStart(2, '0');
    const timeString = `${hours}:${minutes}:${seconds}`;
    document.getElementById('clock').innerText = timeString;
    }
    
    setInterval(updateClock, 1000);
    updateClock(); // Sayfa yüklendiğinde saati hemen göstermek için
    
    </script>
    </body>
    </html>