본문 바로가기

웹개발/javascript

[javascript]타이머(setTimeout)

반응형

타이머(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)결과


반응형