Created
December 18, 2012 04:32
-
-
Save riix/4325027 to your computer and use it in GitHub Desktop.
setTimeout 사용법
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
function targetfunction(){ | |
//ToDo | |
} | |
function timerFunction(){ | |
if(index <20 ){ | |
//20회 미만이면 실행 | |
targetfunction(); | |
index++; | |
timerVar = setTimeout("timerFunction", 1000); //재귀로 settimeout 돌림 | |
} else { | |
clearTimeout(timerVar ) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment