¹®¼ÀÇ °èÅëµµ¿¡¼ °³Ã¼¸¦ Á¦°ÅÇÑ´Ù.
| false | µðÆúÆ®À̸ç, °³Ã¼ÀÇ childNodes Ä÷º¼ÇÀÌ Á¦°ÅµÇÁö ¾Ê´Â´Ù. |
| true | childNodes Ä÷º¼ÇÀÌ Á¦°ÅµÈ´Ù. |
¹Ýȯ°ª oValÀº Á¦°ÅµÈ °³Ã¼ÀÇ ÂüÁ¶ÀÌ´Ù.
ÀÌ ¸Þ¼µå´Â ·±Å¸ÀÓ(run time)¿¡ Á¢¼ÓÇÒ ¼ö ÀÖ´Ù. ·±Å¸ÀÓ¿¡¼ ÀÌ ¿¤·¹¸àÆ®°¡ Á¾·áűװ¡ ÆÄ½ÌµÇ±â Àü¿¡ Á¦°ÅµÇ¸é, ¹®¼ÀÇ Áö¿ªµéÀº Ç¥ÇöµÇÁö ¾ÊÀ» ¼ö ÀÖ´Ù.
| Ä 1-1 | Ä 1-2 |
| Ä 2-1 | Ä 2-2 |
removeNode ¸Þ¼µå·Î °èÅëµµ»ó¿¡¼ Å×À̺íÀ» Á¦°ÅÇÑ´Ù.
ÆÄ¶ó¸ÞÅÍ true¿Í falseÀÇ Â÷À̸¦ º¸¶ó. Çѹø Á¦°ÅÇÏ¸é »õ·Î°íħÀ» ÇØ¾ßÇÑ´Ù.
<SCRIPT>
function doRemove(bVal){
if (!document.all('oTable')){
alert('oTableÀÌ ÀÌ¹Ì Á¦°ÅµÇ¾ú´Ù. »õ·Î°íħ ÈÄ¿¡ ´Ù½Ã ½ÃµµÇ϶ó.');
return false;
}
oTable.removeNode(bVal);
str='oTable.removeNode('+bVal+')<BR>';
str+='parentDiv.all.length='+parentDiv.all.length+'<BR>';
if (parentDiv.all.length){
for (i=0;i< parentDiv.all.length;i++){
str+='parentDiv.all['+i+'].nodeName='+parentDiv.all[i].nodeName+', ';
str+='parentDiv.all['+i+'].innerText='+parentDiv.all[i].innerText+'<BR>';
}
but1.disabled=but2.disabled=true;
}
showA.innerHTML=str;
}
</SCRIPT>
<DIV id=parentDiv>
<TABLE id=oTable border=1 width=400>
<TR><TD id="cell11">Ä 1-1</TD><TD>Ä 1-2</TD></TR>
<TR><TD>Ä 2-1</TD><TD>Ä 2-2</TD></TR>
</TABLE>
</DIV>
<BUTTON onclick="doRemove(true)" style=width:200>oTable.removeNode(true)</BUTTON>
<BUTTON onclick="doRemove(false)" style=width:200>oTable.removeNode(false)</BUTTON><BR>
<!-- <BUTTON onclick="location.reload()" style=width:400>¹®¼ »õ·Î°íħ</BUTTON> -->
<DIV id=showA>°á°ú Ç¥½Ãâ</DIV>