aboutsummaryrefslogtreecommitdiffstats
path: root/csci4131/lec/Lec7Ex1.html
blob: d7c46e4e7f1df15c21498f7e4289f7416af72486 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Titles are for better people</title>
    <script>
        function clock() {
            var datenow = new Date;
            var timenow = datenow.toLocaleTimeString();
            document.getElementById("clock").value = timenow;
        }
        var intId = setInterval(function () { clock() }, 1000);
    </script>
</head>
<body>
    <input type="text" id="clock">
    <button onclick="intId=clearInterval(intId)">STOP</button>
    <button onclick="intId = setInterval(function(){clock()}, 1000)">START</button>
    <button onclick="document.getElementById('clock').value = ''">CLEAR</button>
</body>