본문 바로가기

콩's EDUCATION/콩's Javascript

setTimeout

setTimeout 예제


<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>Window 메소드 1</title>
<script type="text/javascript">
setTimeout(
function() {
    document.getElementById("here").innerHTML
    ="<h1>"+ new Date().toLocaleString() +"</h1>";
    // div 태그 사이에 시간 출력
},1000);
// clearInterver 끝내는 메소드(시간 언제 멈춰줄지 정함)
</script>
</head>
<body>
<div align="center">
1출력. 5초후에 시간을 출력할 예정.
<div id="here"> 시간 출력 위치 </div>
</center>
</body>
</html>


timer.html