반응형
타이머(setTimeout)
형식 : setTimeout("함수명()",시간[1/1000초]);
ex)소스코드
<html>
<head>
<script>
function test_alert(){
setTimeout("alert('test')",2000);
}
</script>
</head>
<body>
<input type="button" onclick="test_alert();" value="2초후 알림">
</body>
</html>
ex)결과
반응형
'웹개발 > javascript' 카테고리의 다른 글
[javascript]예 아니오(confirm) (0) | 2014.04.01 |
---|---|
[javascript]반복(setInterval) (0) | 2013.12.18 |
[javascript]일시정지(sleep) (0) | 2013.12.18 |
[javascript]페이지이동, 뒤로가기 (location,history) (0) | 2013.12.12 |
[javascript]현재시간 출력(custom function) (0) | 2013.12.12 |