ÁöÁ¤µÈ ¿¤·¹¸àÆ®¿¡ ¸ðµç Àбâ/Àб⾲±â ¾ÖÆ®¸®ºäÆ®µéÀ» º¹»çÇÑ´Ù.

Àμö/ÆĶó¸ÞÅÍ
object : (°³Ã¼)
ÇʼöÀûÀÎ ¿ä¼ÒÀ̸ç, Àû¿ëÇÒ ¼ö ÀÖ´Â °³Ã¼ÀÌ´Ù.
oSource
ÇʼöÀûÀÎ ¿ä¼ÒÀ̸ç, mergeAttributes ¸Þ¼­µå·Î ¾ÖÆ®¸®ºäÆ®°¡ º¹»çµÉ °³Ã¼¸¦ ÁöĪÇÏ´Â Áö½ÃÀÚÀÌ´Ù.
bPreserve
¼±ÅÃÀûÀÎ ¿ä¼ÒÀ̸ç, IE5.5¿¡¼­ »ç¿ë °¡´ÉÇÏ°í, ¾ÖÆ®¸®ºÎÆ®°¡ ÅëÇյǴ °³Ã¼ÀÇ µ¿ÀϼºÀ» À¯ÁöÇϴ°¡¸¦ ³ªÅ¸³»´Â ºÎ¿ï°ªÀÌ´Ù.
true µðÆúÆ®À̸ç, ¾ÖÆ®¸®ºÎÆ®°¡ ÅëÇÕ(merge)µÇ´Â °³Ã¼ÀÇ µ¿Àϼº(identity)À» À¯ÁöÇÑ´Ù.
false ¾ÖÆ®¸®ºÎÆ®°¡ ÅëÇյǴ °³Ã¼ÀÇ µ¿ÀϼºÀ» À¯ÁöÇÏÁö ¾Ê´Â´Ù.
¹Ýȯ°ª

¹Ýȯ°ªÀº ¾ø´Ù.

Ư±â

mergeAttributes ¸Þ¼­µå´Â ¿ø·¡ÀÇ HTML ¾ÖÆ®¸®ºäÆ®(attribute), À̺¥Æ®(event)¿Í ½ºÅ¸ÀÏ(style)µéÀ» º¹»çÇÑ´Ù.

IE5.5¿¡¼­´Â id ¼Ó¼º°ú °°Àº Àбâ Àü¿ë ¾ÖÆ®¸®ºäÆ®µéÀº ÅëÇÕ(merge)µÇÁö ¾Ê¾Ò¾ú´Ù.

IE5.5¿¡¼­´Â ¸ñÇ¥ °³Ã¼ÀÇ µ¿Àϼº(identity) À¯Áö¿¡¼­ bPreserve¸¦ ¼³Á¤ÇÏÁö ¾Ê°í, °³Ã¼ÀÇ id¿Í name ¼Ó¼ºÀ» Æ÷ÇÔÇÏ¿© ¸ðµç ¾ÖÆ®¸®ºäÆ®¸¦ ÅëÇÕ(merge)ÇÒ ¼ö ÀÖ°Ô µÇ¾ú´Ù.

Àû¿ë
°³Ã¼scriptIE
ÂüÁ¶
clearAttributes (¿µ¹®)DOM(W3C Document Object Model)

¼Ó¼ºµéÀÌ ¼³Á¤µÈ ¿øº» DIV1 ¿¤·¹¸àÆ®.
´ÜÃß·Î À§ DIV1 ¼Ó¼ºÀÌ º¹»çµÇ´Â DIV2 ¿¤·¹¸àÆ®.
°á°ú Ç¥½Ãâ

mergeAttributes ¸Þ¼­µå·Î º¹»çÇÑ ÈÄ¿¡´Â ³»¿ë¸¸ ´Ù°í ¸ðµç ¿¤·¹¸àÆ®ÀÇ ¼Ó¼ºµéÀº °°¾ÆÁø´Ù.

<SCRIPT>
function doMerge(){
  oSource.children[1].mergeAttributes(oSource.children[0]);
  str='<TABLE border=1><TR bgcolor=dddddd align=center><TD>div1Obj</TD><TD>div2Obj</TD></TR>';
  for (i=0;i< oSource.children[0].attributes.length;i++){
    if (oSource.children[0].attributes[i].specified)
    str+='<TR><TD>'+oSource.children[0].attributes[i].name+'='+oSource.children[0].attributes[i].value+'</TD>';
    if (oSource.children[1].attributes[i].specified)
    str+='<TD>'+oSource.children[1].attributes[i].name+'='+oSource.children[1].attributes[i].value+'</TD></TR>';
  }
  str+='</TABLE>';
  showA.innerHTML=str;
}
</SCRIPT>
<DIV id=oSource>
<DIV id="div1Obj" attribute1="true" attribute2="true" onclick="alert('Ŭ¸¯Çß´Ù.');"
  style="border:solid 1 green;background-color:yellow;width:400"
  onmouseover="this.style.color='#0000FF';"
  onmouseout="this.style.color='#000000';">¼Ó¼ºµéÀÌ ¼³Á¤µÈ ¿øº» <B>DIV1</B> ¿¤·¹¸àÆ®.</DIV>
<DIV id="div2Obj" style="background-color:aqua">´ÜÃß·Î À§ <B>DIV1</B> ¼Ó¼ºÀÌ º¹»çµÇ´Â <B>DIV2</B> ¿¤·¹¸àÆ®.</DIV></DIV>
<INPUT type="button" value="MergeAttributes" onclick="doMerge()" >
<DIV id=showA>°á°ú Ç¥½Ãâ</DIV>