Menu



Manage

파일 목록
Study_Web > ex10-5.html Lines 28 | 765 바이트
다운로드

                        <!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        function startClock() {
            let clock = document.getElementById("clock");
            timeout(clock);
        }
        function timeout(obj) {
            let current = new Date();
            obj.innerHTML = current.toLocaleTimeString()
            setTimeout("timeout(clock)", 1000); //1초마다 타임아웃 호출
        }
    </script>
</head>

<body onload="startClock()">
    <h3>div 태그로 시계 만들기</h3>
    <hr>
    <div id="" clock"></div>
</body>

</html>