본문 바로가기

Study

[자바스크립트]-시간지정대로 새로고침하기


<script>
  
 function pageRefresh() {
  window.setTimeout("pageReload()", 10000);
 }
 
 function pageReload() {
  location.reload();
  //alert('새로고침되었습니다.');
 }
 
 //이렇게 하면 페이지 로딩과 동시에 10초후에 새로고침.
 //window.setTimeout("pageReload()", 10000);
 //새로고침되는 함수를 10초후에 실행하라는 것. 10000 == 10초, 60000 == 1분, 1000 == 1초
 //원하는 시간을 지정한 후 지정한 시간후에 새로고침을 실행
 //새로고침할부분에 <body onload="pageRefresh()"></body>
 
 
 //메타태그 사용시 <meta http-equiv="refresh" content="15"> 해당문서를 15초마다 새로고침.
 
</script>
<body onload="pageRefresh()">
</body>

'Study' 카테고리의 다른 글

8/27  (0) 2010.08.30
HTML JQUERY CSS 설명  (0) 2010.08.24