nodeName, nodeType, nodeValue, firstChild, lastChild, previousSibling, nextSibling ¼Ó¼º ¿¹Á¦


  • Ç׸ñ 1
  • Ç׸ñ 2
  • Ç׸ñ 3
  • Ç׸ñ 4
SPAN1 ³»¿ë SPAN2 ³»¿ë

<DIV id=divObj style="border:solid 1 blue;padding:5">
<IMG id="img1" src="../../../gif/rfproperty.gif"><BR id=br1>
<UL id=ulObj>
<LI id=li1>Ç׸ñ 1
<LI id=li2>Ç׸ñ 2
<LI id=li3>Ç׸ñ 3
<LI id=li4>Ç׸ñ 4
</UL>
<DIV id=div1 style="border:solid 1 gray"><SPAN id=span1>SPAN1 ³»¿ë</SPAN> <SPAN id=span2>SPAN2 ³»¿ë</SPAN></DIV>
<IMG id="img2" src="../../../gif/rfexample.gif"><BR id=br2>
</DIV>

<SCRIPT>
objCol=divObj.all;
str='divObj.all.length=objCol.length='+objCol.length+'<BR>';
str+='<TABLE border=1>';
str+='<COL style=white-space:nowrap>';
str+='<COLGROUP style=text-align:center><COL><COL><COL><COL><COL><COL><COL><COL></COLGROUP>';
str+='<TR class=property style=font-size:80%><TD> </TD><TD>id</TD><TD>nodeName</TD><TD>nodeType</TD>';
str+='<TD>nodeValue</TD><TD>firstChild.id</TD><TD>lastChild.id</TD>';
str+='<TD>previousSibling.id</TD><TD>nextSibling.id</TD></TR>';
for (i=0;i< objCol.length;i++){
  str+='<TR><TD>objCol['+i+']</TD>';
  str+='<TD>'+objCol[i].id+'</TD>';
  str+='<TD>'+objCol[i].nodeName+'</TD>';
  str+='<TD>'+objCol[i].nodeType;
  if (objCol[i].nodeType==1) str+='<SMALL>(element)</SMALL>';
  str+='</TD>';
  str+='<TD>'+objCol[i].nodeValue+'</TD>';

  if ((objCol[i].firstChild)&&(objCol[i].firstChild.id!=undefined)) str+='<TD>'+objCol[i].firstChild.id+'</TD>';
  else str+='<TD>-</TD>';
  if ((objCol[i].lastChild)&&(objCol[i].lastChild.id!=undefined)) str+='<TD>'+objCol[i].lastChild.id+'</TD>';
  else str+='<TD>-</TD>';
  if ((objCol[i].previousSibling)&&(objCol[i].previousSibling.id!=undefined)) str+='<TD>'+objCol[i].previousSibling.id+'</TD>';
  else str+='<TD>-</TD>';
  if ((objCol[i].nextSibling)&&(objCol[i].nextSibling.id!=undefined)) str+='<TD>'+objCol[i].nextSibling.id+'</TD>';
  else str+='<TD>-</TD>';
  str+='</TR>';
}
str+='</TABLE><BR>';
str+='ulObj.previousSibling.nodeName='+ulObj.previousSibling.nodeName+'<BR>';
str+='ulObj.nextSibling.nodeName='+ulObj.nextSibling.nodeName+'<BR>';
str+='ulObj.firstChild.nodeName='+ulObj.firstChild.nodeName+'<BR>';
str+='ulObj.lastChild.innerText='+ulObj.lastChild.innerText+'<BR>';
str+='ulObj.firstChild.nextSibling.innerText='+ulObj.firstChild.nextSibling.innerText+'<BR>';
str+='ulObj.childNodes(0).nextSibling.innerText='+ulObj.childNodes(0).nextSibling.innerText+'<BR>';
str+='divObj.firstChild.src='+divObj.firstChild.src+'<BR>';
document.write(str)
</SCRIPT>