°³Ã¼ÀÇ ¾ÖÆ®¸®ºäÆ®(¼Ó¼º)µéÀÇ ¹è¿º¯¼ö Ä÷º¼ÇÀ» ¹ÝȯÇϰí ÂüÁ¶ÇÑ´Ù.
IE6ºÎÅÍ attributes Ä÷º¼Ç¿¡ °³Ã¼ÀÇ expando ¼Ó¼ºµéÀÌ Æ÷ÇԵǾú´Ù. ÀÌÀü ¹öÀü¿¡¼ °³Ã¼ÀÇ expando ¼Ó¼º¿¡ Á¢¼ÓÇϱâ À§Çؼ´Â for...in¸¦ »ç¿ëÇÑ´Ù.
attributes Ä÷º¼Ç¿¡¼´Â style °³Ã¼¸¦ »ç¿ëÇÒ ¼ö ¾ø°í, °³Ã¼ÀÇ È®½ÇÇÑ ½ºÅ¸ÀϽ¬Æ®¸¦ ¹ÝȯÇϱâ À§Çؼ´Â °³Ã¼ÀÇ style ¼Ó¼ºÀÇ cssText¼Ó¼ºÀ» »ç¿ëÇÑ´Ù.
all°ú children Ä÷º¼Çµî ´Ù¸¥ DHTML Ä÷º¼Çµé°ú´Â ´Ù¸£°Ô attributes Ä÷º¼Ç °íÁ¤Àû(static)ÀÌ´Ù. °³Ã¼ÀÇ ¼Ó¼ºÀ» º¯°æ½ÃÄѵµ ÀÚµ¿ÀûÀ¸·Î ±× °³Ã¼ÀÇ ÂüÁ¶ÇÏ´Â attributes Ä÷º¼Ç¿¡ ¹Ý¿µµÇÁö ¾Ê´Â´Ù.
| °³Ã¼ | script | HTML | ±Ô°Ý | IE |
|---|
ÀÌ Ä÷º¼ÇÀº (¿µ¹®)DOM Level 1(W3C Document Object Model)¿¡ Á¤ÀǵǾú´Ù.
¼³¸íÀ» À§ÇÑ ¿¹Á¦
attributes ¿¹Á¦ |
Ä÷º¼Ç ¿¹Á¦
<SCRIPT>
function showAttribs(elemObj){
str='<TABLE width=100%><TR><TD width=50%>elemObj.nodeName='+elemObj.nodeName;
str+=' (id=<FONT color=blue><B>'+elemObj.id+'</B></FONT>)<BR>';
colAttribs=elemObj.attributes;
for (i=0;i< colAttribs.length;i++){
if(!(i%Math.ceil((colAttribs.length)/2))&&i){
str+='</TD><TD width=50%>';
str+='elemObj.attributes.length=<FONT color=red><B>'+elemObj.attributes.length+'</B></FONT><BR>';
}
atr1=colAttribs[i];
str+='<FONT color=silver>['+i+']</FONT> <FONT color=blue>'+atr1.nodeName+'</FONT>=';
str+='<FONT color=teal>'+atr1.nodeValue+'</FONT> '
str+='(<FONT color=gray>'+(atr1.specified ? '<FONT color=blue><B>true</B></FONT>':'false')+'</FONT>)<BR>';
}
str+='</TD></TR></TABLE>';
showA.innerHTML=str;
}
</SCRIPT>
<DIV style="border:solid 1 green;padding=5" title="°³Ã¼¸¦ Ŭ¸¯Çغ¸¶ó.">
<SPAN onclick="showAttribs(this)" id="span1" style="border:solid 1 blue">SPAN Attributes º¸±â</SPAN>
<U onclick="showAttribs(this)" id="u1" style="border:solid 1 blue">U Attributes º¸±â</U>
<A onclick="showAttribs(this)" id="a1" href="#exampleJump" style="border:solid 1 blue">A Attributes º¸±â</A>
<UL><LI onclick="showAttribs(this)" id="li1" style="border:solid 1 blue">Ç׸ñ 1
<LI onclick="showAttribs(this)" id="li2" style="border:solid 1 blue">Ç׸ñ2</UL>
<DIV onclick="showAttribs(this)" id="div1" style="border:solid 1 blue">DIV Attributes º¸±â</DIV>
<BUTTON onclick="showAttribs(this)" id="but1">´ÜÃß Attributes º¸±â</BUTTON>
</DIV>
<DIV id=showA>°á°ú Ç¥½Ãâ</DIV>