HTML ¿¤·¹¸àÆ® °³Ã¼ÀÇ ¼Ó¼ºÀ» ¹ÝȯÇÏ°í ÂüÁ¶ÇÑ´Ù.
|
Script |
[propVal=]..propName; |
HTML |
¾ø½¿. |
- Ư±â
-
attribute °³Ã¼´Â attributes ÄÌ·º¼ÇÀ» ÅëÇÏ¿© Á¢¼ÓÇÏ°í ÂüÁ¶ÇÒ ¼ö ÀÖ´Ù.
À¯È¿ÇÑ ¼Ó¼ºÀº DHTML °³Ã¼¿¡ Àû¿ëµÇ´Â property³ª event À̺¥Æ®µéÀÌ´Ù. expandoµµ Àû¿ëµÈ´Ù.
IE5 ºÎÅÍ´Â ½ºÅ©¸³Æ®¸¦ »ç¿ëÇÒ ¼ö ÀÖ´Ù.
- ÂüÁ¶
-
attributes
¼³¸íÀ» À§ÇÑ ¿¹Á¦
¾Õ ÇüÁ¦ °³Ã¼ °³Ã¼³» ³»ºÎ DIV, ³»ºÎ SPAN ³»¿ë µÚ ÇüÁ¦ °³Ã¼ |
|
Ä÷º¼Ç | ¼³¸í°ú ¿¹Á¦ ÄÚµå | °á°ú | Âü°í |
attributes |
°³Ã¼ÀÇ ¾ÖÆ®¸®ºäÆ®(attribute °³Ã¼)µéÀÇ ¹è¿º¯¼ö¸¦ ÂüÁ¶ÇÏ°í ¹ÝȯÇÑ´Ù. |
<SCRIPT>document.write(oObj.attributes.length)</SCRIPT> |
|
|
childNodes |
°³Ã¼ÀÇ ¹Ù·Î Á¾¼ÓµÈ ÀڽĵéÀÇ ¿¤·¹¸àÆ® °³Ã¼µé°ú TextNode °³Ã¼µéÀÇ ¹è¿º¯¼ö¸¦ ÂüÁ¶ÇÏ°í ¹ÝȯÇÑ´Ù. |
<SCRIPT>document.write(colObj.childNodes.length)</SCRIPT> |
|
expando ¼Ó¼º
IE
¢¡ °³Ã¼ ³»ºÎ¿¡¼ ¾ÖÆ®¸®ºäÆ®¸¦ »ý¼ºÇÒ ¼ö Àִ°¡¸¦ ¹ÝȯÇϰųª ¼³Á¤ÇÑ´Ù.
¹®¹ý: .expando
ÄÚµå: document.write(oObj.expando);
°á°ú:
firstChild ¼Ó¼º
IE
¢¡ °³Ã¼ÀÇ
childNodes Ä÷º¼Ç¿¡¼ Á¦ÀÏ ¸ÕÀú ÀÚ½Ä °³Ã¼À» ¹ÝȯÇÑ´Ù.
¹®¹ý: [oVal=].firstChild
ÄÚµå: document.write(oObj.firstChild);
°á°ú:
ÄÚµå: if (oObj.firstChild) document.write(oObj.firstChild.nodeName);
°á°ú:
lastChild ¼Ó¼º
IE
¢¡ °³Ã¼ÀÇ
childNodes Ä÷º¼Ç¿¡¼ ¸¶Áö¸· ÀÚ½Ä °³Ã¼À» ¹ÝȯÇÑ´Ù.
¹®¹ý: [oVal=].lastChild
ÄÚµå: document.write(oObj.lastChild;
°á°ú:
ÄÚµå: if (oObj.lastChild) document.write(oObj.lastChild.innerText);
°á°ú:
name ¼Ó¼º
IE (
<ELEMENT name=
"sVal"> ¾ÖÆ®¸®ºäÆ®)
¢¡ °³Ã¼ÀÇ À̸§À» ¹ÝȯÇϰųª ¼³Á¤ÇÑ´Ù.
¹®¹ý: .name[=sVal]
ÄÚµå: document.write(oObj.name);
°á°ú:
nextSibling ¼Ó¼º
IE
¢¡ °³Ã¼ÀÇ ´ÙÀ½ ÇüÁ¦(°°Àº ¸ðüÀÇ ´ÙÀ½ ÀÚ½Ä) °³Ã¼À» ¹ÝȯÇÑ´Ù.
¹®¹ý: [oVal=].nextSibling
ÄÚµå: document.write(oObj.nextSibling);
°á°ú:
ÄÚµå: if (oObj.nextSibling) document.write(oObj.nextSibling.innerText);
°á°ú:
nodeName ¼Ó¼º
IE
¢¡ °³Ã¼ÀÇ Æ¯Á¤ ³ëµå(node) ŸÀÔ À̸§À» ¹ÝȯÇÑ´Ù.
¹®¹ý: [oVal=].nodeName
ÄÚµå: document.write(oObj.nodeName);
°á°ú:
nodeType ¼Ó¼º
IE
¢¡ °³Ã¼ÀÇ Æ¯Á¤ ³ëµå(node)ÀÇ Á¾·ù¸¦ ¹ÝȯÇÑ´Ù.
¹®¹ý: [oVal=].nodeType
ÄÚµå: document.write(oObj.nodeType);
°á°ú:
nodeValue ¼Ó¼º
IE
¢¡ °³Ã¼ÀÇ Æ¯Á¤ ³ëµå(node)ÀÇ °ªÀ» ¹ÝȯÇÑ´Ù.
¹®¹ý: [oVal=].nodeValue
ÄÚµå: document.write(oObj.nodeValue);
°á°ú:
ownerDocument ¼Ó¼º
IE6
¢¡ ³ëµå(node)¿¡ ¿¬°üÇÑ
document °³Ã¼¸¦ ¹ÝȯÇϰųª ¼³Á¤ÇÑ´Ù.
¹®¹ý: .ownerDocument[=oVal]
ÄÚµå: document.write(oObj.ownerDocument);
°á°ú:
ÄÚµå: document.write(oObj.ownerDocument.nodeName);
°á°ú:
parentNode ¼Ó¼º
IE
¢¡ ±¸Á¶»ó ºÎ¸ð ¿¤·¹¸àÆ® °³Ã¼¸¦ ¹ÝȯÇÑ´Ù.
¹®¹ý: .parentNode
ÄÚµå: document.write(oObj.parentNode);
°á°ú:
ÄÚµå: document.write(oObj.parentNode.nodeName);
°á°ú:
previousSibling ¼Ó¼º
IE
¢¡ °³Ã¼ÀÇ ´ÙÀ½ ÇüÁ¦(°°Àº ¸ðüÀÇ ´ÙÀ½ ÀÚ½Ä) °³Ã¼À» ¹ÝȯÇÑ´Ù.
¹®¹ý: [oVal=].previousSibling
ÄÚµå: document.write(oObj.previousSibling);
°á°ú:
ÄÚµå: if (oObj.previousSibling) document.write(oObj.previousSibling.innerTexte);
°á°ú:
specified ¼Ó¼º
IE
¢¡ °³Ã¼ÀÇ ¾ÖÆ®¸®ºäÆ®°¡ ÁöÁ¤µÇ¾ú´Â°¡¸¦ ¹ÝȯÇÑ´Ù.
¹®¹ý: [bVal=].attributes(sVal).specified
ÄÚµå: document.write(oObj.attributes('name').specified);
°á°ú:
value ¼Ó¼º
IE6
¢¡ °³Ã¼ÀÇ ¼Ó¼º°ªÀ» ¹ÝȯÇÑ´Ù.
¹®¹ý: [vVal=].attributes(sVal).value
ÄÚµå: document.write(oObj.attributes('name').value);
°á°ú:
¸Þ¼µå | ¼³¸í |
appendChild |
°³Ã¼ÀÇ Àڽݳü·Î ÇÑ ¿¤·¹¸àÆ®¸¦ Ãß°¡ÇÑ´Ù. |
cloneNode |
¹®¼ °èÅëµµ·ÎºÎÅÍ °³Ã¼ÀÇ ÂüÁ¶¸¦ º¹»çÇÑ´Ù. |
hasChildNodes |
°³Ã¼°¡ Àڽݳü¸¦ °¡Áö°í °¡Áö°í Àִ°¡¸¦ ³ªÅ¸³»´Â °ªÀ» ¹ÝȯÇÑ´Ù. |
insertBefore |
¹®¼ °èÅëµµ¿¡¼ ¸ðü °³Ã¼ÀÇ ÀÚ½Ä ³ëµå·Î ¿¤·¹¸àÆ®¸¦ »ðÀÔÇÑ´Ù. |
removeChild |
°³Ã¼·ÎºÎÅÍ ÀÚ½Ä ³ëµå¸¦ Á¦°ÅÇÑ´Ù. |
replaceChild |
ÇöÀçÀÇ ÀÚ½Ä ¿¤·¹¸àÆ®¸¦ »õ·Î¿î ÀÚ½Ä ¿¤·¹¸àÆ®·Î ±³Ã¼ÇÑ´Ù. |
<BUTTON>ÀÇ °³Ã¼ ¿¹Á¦
°á°ú Ç¥½Ãâ
<BUTTON id="butObj" onclick="showAttribs1(butObj)" lang="ko" name="buttonName">Ŭ¸¯ ´ÜÃß¿¡ ÁöÁ¤µÈ attribute</BUTTON>
<SCRIPT>
function showAttribs1(){
str='';
for(i=0;i< butObj.attributes.length;i++){
if (butObj.attributes[i].specified) str+=i+'] '+butObj.attributes[i].nodeName+'='+butObj.attributes[i].nodeValue+'<BR>';
}
showA.innerHTML=str;
}
</SCRIPT>
<DIV id=showA>°á°ú Ç¥½Ãâ</DIV>
<TABLE>ÀÇ °³Ã¼ ¿¹Á¦
TABLE ¿¹Á¦
°á°ú | ÄÚµå |
|
<TABLE id=tableObj align=center border=1>
<TR id="trObj" name="testTRname" bgcolor="#ffffaa" value="testValue"
lang="ko" title="testAttriblue" align="center" valign="middle" borderColor="red">
<TD id="tdObj">Ç׸ñ1</TD>
<TD>Ç׸ñ2</TD>
<TD>Ç׸ñ3</TD></TR>
</TABLE>
|
|
<DIV class=show id=showit style=margin-left:1em></DIV>
<SCRIPT>
str='';
for(i=0;i<trObj.attributes.length;i++){
if(trObj.attributes[i].specified){
str+=trObj.attributes[i].nodeName + " = " + trObj.attributes[i].nodeValue+'<BR>';
}
}
showit.innerHTML=str;
</SCRIPT>
|
|