Created
April 12, 2013 02:01
-
-
Save thirdj/5368715 to your computer and use it in GitHub Desktop.
time method
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| setTimeout(); // 일정 시간 후에 함수를 한 번 실행 | |
| setInterval(); // 일정 시간마다 함수를 반복 실행 | |
| clearTimeout(); // 일정 시간 후에 함수를 한 번 실행하는 것을 중지 | |
| clearInterval(); // 일정 시간마다 함수를 반복하는 것을 중지 | |
| /* | |
| Eaxmple | |
| **/ | |
| window.onload = function(){ | |
| // 윈도우가 로드될 때 | |
| var intervalID = setInterval(function(){ | |
| document.body.innerHTML += '<p>' + new Date() + '</p>'; | |
| }, 1000); | |
| // 10초 후 함수를 실행합니다. | |
| setTimeout(function() { | |
| // 타이머를 종료합니다. | |
| clearInterval(intervalID); | |
| }, 10000); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment