¿¤·¹¸àÆ®¿¡¼­ ÷ºÎµÈ ºñÇìÀ̹ö°¡ Á¦°ÅµÇ±â ¹Ù·ÎÀü¿¡ ¹ß»ýµÈ´Ù.

<PUBLIC:ATTACH event=ondetach for=object id=sID onevent=handler>

event ¼±ÅÃÀûÀÎ ¿ä¼ÒÀ̸ç, À̺¥Æ® À̸§(À̺¥Æ® ¸ñ·Ï)À» ÁöÁ¤Çϰųª, HTC ¸ñ·Ï¿¡ ¿­°ÅµÈ ÄÄÆ÷³ÙÆ®ÀÇ Æ¯Á¤ À̺¥Æ®¸¦ ÁöÁ¤ÇÏ´Â ¹®ÀÚ¿­ÀÌ´Ù.
for ¼±ÅÃÀûÀÎ ¿ä¼ÒÀ̸ç, À̺¥Æ® ¿øõ ¿¤·¹¸àÆ®¸¦ ÀνÄÇϱâ À§ÇÏ¿© ÁöÁ¤ÇÏ´Â ¹®ÀÚ¿­ÀÌ´Ù.
document document °³Ã¼¸¦ ÂüÁ¶ÇÑ´Ù.
element µðÆúÆ®À̸ç, ºñÇìÀ̹ö°¡ ÷ºÎµÈ ¿¤·¹¸àÆ®¸¦ ÂüÁ¶ÇÑ´Ù.
window window °³Ã¼¸¦ ÂüÁ¶ÇÑ´Ù.
id ¼±ÅÃÀûÀÎ ¿ä¼ÒÀ̸ç, ÄÞÆ÷³ÙÆ® ¼ÓÀÇ PUBLIC:ATTACH ¿¤·¹¸àÆ®ÀÇ À¯ÀÏÇÑ ÀνÄÀÚ¸¦ ÁöÁ¤ÇÏ´Â ¹®ÀÚ¿­ÀÌ´Ù.
onevent ÇʼöÀûÀÎ ¿ä¼ÒÀ̸ç, ÀζóÀÎ ½ºÅ©¸³Æ®¸¦ ÁöÁ¤Çϰųª À̺¥Æ®Ã³¸®ÀÚ ±â´ÉÇÔ¼ö¸¦ Á÷Á¢ÀûÀ¸·Î È£ÃâÇÏ´Â ¹®ÀÚ¿­ÀÌ´Ù.
Ư±â

ondetach À̺¥Æ®´Â ¿¤·¹¸àÆ®·ÎºÎÅÍ ¿ÏÀüÈ÷ Á¦°ÅµÇ±â ¹Ù·ÎÀü¿¡ ÀÏÁ¾ÀÇ Á¤¸®¸¦ ¼öÇàÇÒ ¼ö ÀÖ°Ô ÇØ ÁØ´Ù.

attachEvent ¸Þ¼­µå¸¦ »ç¿ëÇÏ¿© ¸ðü ¹®¼­¿¡¼­ ºñÇìÀ̹ö°¡ À̺¥Æ®¿¡ ÷ºÎµÇ¾î ÀÖÀ¸¸é, ÀÌ À̺¥Æ®´Â ºñÇìÀÌ·Î ÇÏ¿©±Ý ¹®¼­·ÎºÎÅÍ Å뺸 ¹ÞÀ½À» Áß½ÃÁöÅ°±â À§ÇÏ¿© detachEvent ¸Þ¼­µå¸¦ È£Ãâ ÇÒ ¼ö ÀÖ°Ô ÇÑ´Ù.

PUBLIC:ATTACH ¿¤·¹¸àÆ®¸¦ »ç¿ëÇÏ¿© ¹®¼­ÀÇ À̺¥Æ®¿¡ ÷ºÎµÈ ºñÇìÀ̹ö´Â, ºñÇìÀ̹ö°¡ Á¦°ÅµÇ¸é, Å뺸 ¹ÞÀ½À» ÀÚµ¿ÀûÀ¸·Î Áß½ÃÁöÅ°¸ç, ondetach À̺¥Æ®°¡ ¹ß»ýµÇ¸é detachEvent ¸Þ¼­µå¸¦ »ç¿ëÇÒ ÇÊ¿ä´Â ¾ø´Ù.

ÂüÁ¶
detachEvent, attachEvent, behavior

DIV¿¡¼­ ondetach À̺¥Æ® ¿¹Á¦

DIV¿¡¼­ ondetach À̺¥Æ® ¿¹Á¦¿¡ ¸¶¿ì½º¸¦ ¿Ã·Áº¸¶ó.
°á°ú Ç¥½Ãâ

ondetach À̺¥Æ®·Î ´çÃÊ¿¡ ÷ºÎµÈ °­Á¶ ºñÇìÀ̹ö¿¡¼­ ¸ñ·Ï Ç׸ñÀÇ °­Á¶ È¿°ú¸¦ º¯°æ½ÃŲ´Ù.

<PUBLIC:ATTACH event="ondetach" onevent="cleanup()" />
<DIV id=divObj style="color:green;cursor:arrow;border:solid 1 blue;padding:5;background:ffa">
DIV¿¡¼­ ondetach À̺¥Æ® ¿¹Á¦¿¡ ¸¶¿ì½º¸¦ ¿Ã·Áº¸¶ó.
</DIV>
<SCRIPT>
document.onload=doAtach();
function doAtach(){
  divObj.attachEvent ('onmouseover', Hilite);
  divObj.attachEvent ('onmouseout', Restore);
}
function doDetach(){
  divObj.detachEvent('onmouseover',Hilite);
  divObj.detachEvent('onmouseout', Restore)
  showA.innerHTML='';
}
function cleanup(){
  divObj.detachEvent ('onmouseover', Hilite);
  divObj.detachEvent ('onmouseout', Restore);
}
function Hilite(){
  str='';
  if (event.srcElement == divObj) {
    normalColor = divObj.style.color;
    divObj.runtimeStyle.color  = 'red';
    divObj.runtimeStyle.cursor = 'hand';
    doShow()
  }
}
function Restore(){
  if (event.srcElement == divObj) {
    divObj.runtimeStyle.color  = normalColor;
    divObj.runtimeStyle.cursor = 'arrow';
    doShow()
  }
}
function doShow(){
  str='event.srcElement.nodeName='+event.srcElement.nodeName+'<BR>';
  str+='event.srcElement.id='+event.srcElement.id+'<BR>';
  str+='event.type='+event.type+'<BR>';
  str+='normalColor='+normalColor+'<BR>';
  str+='divObj.runtimeStyle.color='+divObj.runtimeStyle.color+'<BR>';
  str+='divObj.runtimeStyle.cursor='+divObj.runtimeStyle.cursor+'<BR>';
  showA.innerHTML=str;
}
</SCRIPT>
<BUTTON onclick="doAtach()">À̺¥Æ® ÷ºÎ</BUTTON>
<BUTTON onclick="doDetach()">À̺¥Æ® Á¦°Å</BUTTON>
<DIV id=showA style=height:7em>°á°ú Ç¥½Ãâ</DIV>