Nandakumar
Content Network

You are not logged in.
Click here to login.

Some part of this library is not public. You must register to get exclusive access. If you are already registered, click here to login.


Web Development >> 2017

JavaScript Digital Clock

By | | License: proprietary


Code
<html>
    <head>
        <title>JavaScript Digital Clock</title>
        <style>
            body {
                text-align: center;
            }
        
            #pTime {
                font-family: monospace;
                font-weight: bold;
                font-size: 2em;
            }
        </style>
        <script>
            var pTime;
            
            function onEachSecond() {
                date = new Date();
                pTime.innerHTML = date.toLocaleTimeString();
            }
            
            function onLoaded() {
                pTime = document.getElementById("pTime");
                setInterval(onEachSecond, 1000);
                onEachSecond();
            }
        </script>
    </head>
    
    <body onload="onLoaded()">
        <h1>JavaScript Digital Clock</h1>
        <p id="pTime" />
    </body>
</html>

Keywords (click to browse): digital-clock clock time toLocaleString setInterval web internet websites web-designing web-programming web-apps www

JavaScript Digital Clock | Nandakumar Content Network
Copyright © 2015, 2016, 2017 Nandakumar Edamana.