Web Development/JavaScript
3초마다 모달창으로 "Hello" 구현하기
스타차일드 라이브러리
2021. 7. 17. 09:18
반응형
Window setInterval() Method
Click the button to wait 3 seconds, then alert "Hello". After clicking away the alert box, an new alert box will appear in 3 seconds. This goes on forever...
setInterval(function(){ alert("Hello"); }, 3000);
Parameter | Description |
function | Required. The function that will be executed |
milliseconds | Required. The intervals (in milliseconds) on how often to execute the code. If the value is less than 10, the value 10 is used |
param1, param2, ... | Optional. Additional parameters to pass to the function (Not supported in IE9 and earlier) |
잘 사용하면 아주 아름다운 코드를 짤 수 있지만, 마음만 먹으면 공포 그 자체를 만들 수 있는 메서드이기도 하다.
Related Pages
- Window Object: clearInterval() Method
- Window Object: setTimeout() Method
- Window Object: clearTimeout() Method
반응형