본문 바로가기

Script

카운트 다운

카운드 다운 :

<span id="countdown"></span>  원하는 곳에 넣는다.

<script>
	$(function() {
	var timeleft = 10;
	var downloadTimer = setInterval(function(){
	  if(timeleft <= 0){
		clearInterval(downloadTimer);
		document.getElementById("countdown").innerHTML = "Go";
	  } else {
		document.getElementById("countdown").innerHTML = timeleft + " s";
	  }
	  timeleft -= 1;
	}, 1000);
});
</script>