ÁöÁ¤µÈ ¿¤·¹¸àÆ®¿¡ ¸ðµç Àбâ/Àб⾲±â ¾ÖÆ®¸®ºäÆ®µéÀ» º¹»çÇÑ´Ù.
true | µðÆúÆ®À̸ç, ¾ÖÆ®¸®ºÎÆ®°¡ ÅëÇÕ(merge)µÇ´Â °³Ã¼ÀÇ µ¿Àϼº(identity)À» À¯ÁöÇÑ´Ù. |
false | ¾ÖÆ®¸®ºÎÆ®°¡ ÅëÇյǴ °³Ã¼ÀÇ µ¿ÀϼºÀ» À¯ÁöÇÏÁö ¾Ê´Â´Ù. |
¹Ýȯ°ªÀº ¾ø´Ù.
mergeAttributes ¸Þ¼µå´Â ¿ø·¡ÀÇ HTML ¾ÖÆ®¸®ºäÆ®(attribute), À̺¥Æ®(event)¿Í ½ºÅ¸ÀÏ(style)µéÀ» º¹»çÇÑ´Ù.
IE5.5¿¡¼´Â id ¼Ó¼º°ú °°Àº Àбâ Àü¿ë ¾ÖÆ®¸®ºäÆ®µéÀº ÅëÇÕ(merge)µÇÁö ¾Ê¾Ò¾ú´Ù.
IE5.5¿¡¼´Â ¸ñÇ¥ °³Ã¼ÀÇ µ¿Àϼº(identity) À¯Áö¿¡¼ bPreserve¸¦ ¼³Á¤ÇÏÁö ¾Ê°í, °³Ã¼ÀÇ id¿Í name ¼Ó¼ºÀ» Æ÷ÇÔÇÏ¿© ¸ðµç ¾ÖÆ®¸®ºäÆ®¸¦ ÅëÇÕ(merge)ÇÒ ¼ö ÀÖ°Ô µÇ¾ú´Ù.
°³Ã¼ | script | IE |
---|
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>