How to create a Web Clock ?

<html>
<head>
         <script type="text/javascript">
            window.setInterval("updateTime()", 1000);

            function updateTime() {
                var now = new Date();
                var tHrs = now.getHours();
                var tMin = now.getMinutes();
                var tSec = now.getSeconds();
                var tTime = ((tHrs < 10) ? "0" + tHrs : tHrs) + ":" + ((tMin < 10) ? "0" + tMin : tMin) + ":" + ((tSec < 10) ? "0" + tSec : tSec);
                document.getElementById("timeLabel").innerHTML = tTime;

            }
        </script>
</head>


<body>
        <span id="timeLabel"></span></span><span style="cursor: hand; float: right; font-stretch: expanded; padding-right: 10px;">
</body>
</html>




Post a Comment

2 Comments