반응형
반복(setInterval)
형식 : setInterval("함수명()",시간[1/1000초]) //해당초마다 펑션을 실행
ex)소스
<html>
<head>
<script>
function test_alert(){
setInterval(function() {
"alert('test')"
}, 1000);
}
</script>
</head>
<body onload=test_alert()>
</body>
</html>
ex)결과
1초마다 alert창이 뜬다
반응형
'웹개발 > javascript' 카테고리의 다른 글
[javascript]바이트 체크하기 (0) | 2015.06.14 |
---|---|
[javascript]예 아니오(confirm) (0) | 2014.04.01 |
[javascript]타이머(setTimeout) (0) | 2013.12.18 |
[javascript]일시정지(sleep) (0) | 2013.12.18 |
[javascript]페이지이동, 뒤로가기 (location,history) (0) | 2013.12.12 |