À©µµ¿ìÀÇ ¼öÇ๮À̳ª ±â´ÉÇÔ¼ö¸¦ ÀÏÁ¤ÇÑ ½Ã°£ °£°ÝÀ¸·Î ¹Ýº¹Çؼ­ ¼öÇàµÈ´Ù.

Àμö/ÆĶó¸ÞÅÍ
window : (À©µµ¿ì °³Ã¼)

ÇʼöÀûÀÎ ¿ä¼ÒÀ̸ç, ÇöÀçÀÇ À©µµ¿ì °³Ã¼ÀÌ´Ù.

vCode : (Ç¥Çö½Ä) ȤÀº (±â´ÉÇÔ¼ö À̸§)
ÇʼöÀûÀÎ ¿ä¼ÒÀ̸ç, ÁöÁ¤µÈ ½Ã°£ÀÌ Áö³ª¸é ¼öÇàµÉ ±â´ÉÇÔ¼öÀÇ Æ÷ÀÎÅÍÀÎ ±â´ÉÇÔ¼ö(function name) ȤÀº ¼öÇàÀ» À§ÇÑ ÄÚµåµé·Î ±¸¼ºµÈ Ç¥Çö½Ä(script code) ¹®ÀÚ¿­À» ÁöÁ¤ÇÏ´Â °ªÀÌ´Ù.

imillisec : (¹Ð¸®ÃÊ°ª)
ÇʼöÀûÀÎ ¿ä¼ÒÀ̸ç, ÀÏÁ¤ÇÑ ½Ã°£ °£°ÝÀÇ ¹Ýº¹À» ³ªÅ¸³»´Â ¹Ð¸®ÃÊ(Milliseconds) ´ÜÀ§ÀÇ Á¤¼ö°ªÀÌ´Ù.
sLang : (½ºÅ©¸³Æ® ¾ð¾î)
¼±ÅÃÀûÀÎ ¿ä¼ÒÀ̸ç, ¾ð¾î¸¦ ÁöÁ¤ÇÏ´Â ¹®ÀÚ¿­ÀÌ´Ù.
JScript µðÆúÆ®À̸ç, JScript ¾ð¾îÀÌ´Ù.
VBScript VBScript ¾ð¾îÀÌ´Ù.
JavaScript JavaScript ¾ð¾îÀÌ´Ù.
¹Ýȯ°ª

¹Ýȯ°ª oTimerId´Â clearInterval ¸Þ¼­µå¿¡ ÀÇÇÏ¿© ŸÀ̸Ӱ¡ Ãë¼ÒµÉ ¶§ÀÇ ½Ã°£ ÀνÄÀÚ¸¦ ¹ÝȯÇÑ´Ù.

¼³¸í

setInterval ¸Þ¼­µå´Â ÁöÁ¤ÇÑ ÀÏÁ¤ÇÑ ¹Ð¸®ÃÊ°ª imillisec ½Ã°£ °£°ÝÀ¸·Î Ç¥Çö½Ä javascriptCode³ª ±â´ÉÇÔ¼ö functionNameÀ» È£ÃâÇÏ´Â ¼ö´ÜÀ» Á¦°øÇÑ´Ù.

ÀÌ ÀÏÁ¤ÇÑ ½Ã°£ °£°ÝÀ¸·Î ¹Ýº¹µÇ´Â ÀÛ¾÷Àº clearInterval ¸Þ¼­µå¸¦ ¸¸³¯ ¶§±îÁö ȤÀº À©µµ¿ì°¡ ´Ý±æ ¶§±îÁö °è¼ÓµÈ´Ù.

Ư±â

Ç¥Çö½ÄÀ̳ª ±â´ÉÇÔ¼ö°¡ ³»ÀåµÈ ±â´É¿¡ ÀÇÇÏ¿© eval() ±â´ÉÇÔ¼ö¿¡ ÁØÇØ Æò°¡µÇ¹Ç·Î, Á÷Á¢ ¼öÇàµÇÁö ¾Êµµ·Ï ¹Ýµå½Ã µû¿ÈÇ¥·Î ¹­¿©¾ß ÇÑ´Ù.

Á¦°øµÈ Àμö°¡ À¯È¿ÇÏÁö ¾ÊÀ¸¸é ¾Æ¹« ¼öÇ൵ µÇÁö ¾Ê¾Æ ¾Æ¹« º¯È­µµ ¾ø´Ù.

IE5 ÀÌÀü ¹öÀü¿¡¼­´Â clearIntervalÀÇ Ã¹ ÆĶó¸ÞÅÍ°¡ ¹®ÀÚ¿­À̾î¾ß¸¸ Çß¾ú´Ù. ¹®ÀÚ¿­ÀÇ ÆÇÁ¤Àº ÁöÁ¤µÈ ÀÎÅ͹ßÀÌ Áö³¯ ‹š±îÁö À¯º¸µÇ¾ú´Ù.

IE5¿¡¼­´Â clearIntervalÀÇ Ã¹ ÆĶó¸ÞÅÍ°¡ ¹®ÀÚ¿­À̳ª ±â´ÉÇÔ¼ö Áö½ÃÀÚ°¡ µÉ ¼ö ÀÖ´Ù.

±â´ÉÇÔ¼ö¸¦ Àü´ÞÇϱâ À§ÇÏ¿© ±â´É ¸íĪÀ» ÆĶó¸ÞÅÍ·Î Á¦°øÇÑ´Ù.

window.setInterval("someFunction()", 5000);

±â´ÉÇÔ¼ö Æ÷ÀÎÅ͸¦ Àü´ÞÇÒ ¶§´Â °ýÈ£¸¦ »ç¿ëÇÏÁö ¸»¶ó.

window.setInterval(someFunction, 5000);

behavior¿Í ÇÔ²² setInterval ¸Þ¼­µå¸¦ »ç¿ëÇÒ ¶§, vCodeÀÇ °ªÀº HTC(HTML Component) ÆÄÀÏ ¼ÓÀÇ ±â´ÉÇÔ¼ö¸¦ È£ÃâÇÏ´Â ±â´ÉÇÔ¼ö Áö½ÃÀÚÀ̰ųª, ÀÏÂ÷ ¹®¼­¿¡ ÀÖ´Â ±â´ÉÇÔ¼ö¸¦ È£ÃâÇÏ´Â ¹®ÀÚ¿­À̾î¾ß ÇÑ´Ù.

Àû¿ë
°³Ã¼scriptIE
ÂüÁ¶
clearInterval setInterval clearTimeout setTimeout


<FORM name="myForm"><INPUT name="myTimer" type="Text" size="30"></FORM>
<SCRIPT>
self.setInterval('timer()',100);
function timer(){
  document.myForm.myTimer.value=new Date();
}
</SCRIPT>

<SCRIPT>
var ms;
function getMilSec(){
  ms=new Date().getMilliseconds();
}
function showMilSec(){
  getMilSec();
  showB.innerHTML=ms;
}
</SCRIPT>
<DIV id=showB style=text-align:right;width:100></DIV>
<BUTTON onclick="msTimer=window.setInterval('showMilSec()',10);">¹Ð¸®ÃÊ ½ÃÀÛ</BUTTON>
<BUTTON onclick="if (msTimer) window.clearInterval(msTimer);">¹Ð¸®ÃÊ Á¾·á</BUTTON>

±â´ÉÇÔ¼ö Æ÷ÀÎÅ͸¦ »ç¿ëÇÑ ¿¹Á¦

 
<DIV id=showA style="color:blue"> </DIV>
<SCRIPT>
iSw=1;
function callA(){
  showA.innerHTML=new Date().toLocaleString();
  iSw=0;
}
function callB(){
  showA.innerHTML=new Date().toUTCString();
  iSw=1;
}
function clockA(){
  if (iSw) callA();
  else callB();
}
</SCRIPT>
<INPUT type=button value="ŸÀÌ¸Ó ½ÃÀÛ" onClick="timerA=window.setInterval('clockA()',1000);">
<INPUT type=button value="ŸÀÌ¸Ó ÁßÁö" onClick="if (timerA) window.clearInterval(timerA)">